Skip to content

Commit 3e606de

Browse files
authored
Merge pull request #89724 from brunoborges/master
Documentation on Kotlin-based Maven Archetype
2 parents fcd27d5 + 881f545 commit 3e606de

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

articles/azure-functions/functions-create-first-java-maven.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,3 +226,6 @@ You have created a Java function app with a simple HTTP trigger and deployed it
226226
- Add additional functions with different triggers to your project using the `azure-functions:add` Maven target.
227227
- Write and debug functions locally with [Visual Studio Code](https://code.visualstudio.com/docs/java/java-azurefunctions), [IntelliJ](functions-create-maven-intellij.md), and [Eclipse](functions-create-maven-eclipse.md).
228228
- Debug functions deployed in Azure with Visual Studio Code. See the Visual Studio Code [serverless Java applications](https://code.visualstudio.com/docs/java/java-serverless#_remote-debug-functions-running-in-the-cloud) documentation for instructions.
229+
230+
> [!NOTE]
231+
> You can also create a Kotlin-based Azure Functions project by using the azure-functions-kotlin-archetype instead. Visit the [GitHub repository](https://github.com/microsoft/azure-maven-archetypes/tree/develop/azure-functions-kotlin-archetype) for more information.

articles/azure-functions/functions-reference-java.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,42 @@ ms.author: routlaw
1919

2020
The Azure Functions runtime supports [Java SE 8 LTS (zulu8.31.0.2-jre8.0.181-win_x64)](https://repos.azul.com/azure-only/zulu/packages/zulu-8/8u181/). This guide contains information about the intricacies of writing Azure Functions with Java.
2121

22-
A Java function is a `public` method, decorated with the annotation `@FunctionName`. This method defines the entry for a Java function, and must be unique in a particular package.
22+
As it happens to other languages, a Function App may have one or more functions. A Java function is a `public` method, decorated with the annotation `@FunctionName`. This method defines the entry for a Java function, and must be unique in a particular package. One Function App written in Java may have multiple classes with multiple public methods annotated with `@FunctionName`.
2323

2424
This article assumes that you have already read the [Azure Functions developer reference](functions-reference.md). You should also complete the Functions quickstart to create your first function, by using [Visual Studio Code](functions-create-first-function-vs-code.md) or [Maven](functions-create-first-java-maven.md).
2525

2626
## Programming model
2727

2828
The concepts of [triggers and bindings](functions-triggers-bindings.md) are fundamental to Azure Functions. Triggers start the execution of your code. Bindings give you a way to pass data to and return data from a function, without having to write custom data access code.
2929

30+
## Project Scaffolding
31+
32+
The simplest way to scaffold a Java-based Azure Function project is to use `Apache Maven` archetypes. You can also find project generation wizards on Visual Studio Code, and the Azure Toolkits for Eclipse and IntelliJ.
33+
34+
There are currently two Azure Functions archetypes for Maven:
35+
36+
### Java Archetype
37+
38+
This archetype is published under the following groupId and artifactId [com.microsoft.azure:azure-functions-archetype](https://search.maven.org/artifact/com.microsoft.azure/azure-functions-archetype/).
39+
40+
```
41+
mvn archetype:generate \
42+
-DarchetypeGroupId=com.microsoft.azure \
43+
-DarchetypeArtifactId=azure-functions-archetype
44+
```
45+
46+
### Kotlin Archetype (Preview)
47+
48+
This archetype is published under the following groupId and artifactId [com.microsoft.azure:azure-functions-kotlin-archetype](https://search.maven.org/artifact/com.microsoft.azure/azure-functions-kotlin-archetype/).
49+
50+
```
51+
mvn archetype:generate \
52+
-DarchetypeGroupId=com.microsoft.azure \
53+
-DarchetypeArtifactId=azure-functions-kotlin-archetype
54+
```
55+
56+
The source code of these archetypes can be found on the [Azure Maven Archetypes GitHub repository](https://github.com/microsoft/azure-maven-archetypes).
57+
3058
## Folder structure
3159

3260
Here is the folder structure of an Azure Functions Java project:
@@ -53,6 +81,8 @@ FunctionsProject
5381
| - pom.xml
5482
```
5583

84+
_* The Kotlin project looks very similar since it is still Maven_
85+
5686
You can use a shared [host.json](functions-host-json.md) file to configure the function app. Each function has its own code file (.java) and binding configuration file (function.json).
5787

5888
You can put more than one function in a project. Avoid putting your functions into separate jars. The `FunctionApp` in the target directory is what gets deployed to your function app in Azure.

0 commit comments

Comments
 (0)