We will create a simple Azure Java project as follows:.
- Create a new directory for the project and run the mvn archetype:generate command, given as follows:
mvn archetype:generate
-DarchetypeGroupId=com.microsoft.azure
-DarchetypeArtifactId=azure-functions-archetype
Note: If you are using Windows, you may replace with ^.
Provide values for the variables, as follows:
-
- Define the value for the 'groupId': tech.heartin.books.serverless-cookbook property
- Define the value for the 'artifactId' : helloworld-azure-fn property
- Define the value for the 'version' 1.0-SNAPSHOT : : property
- Define the value for the 'package': tech.heartin.books.serverlesscookbook property
- Define the value for the 'appName' : HelloWorldAzureFn property
- Define the value for the 'appRegion' 'westus': property
- Define the value for the 'resourceGroup' java-functions-group: : property
- Confirm the properties configuration using:Y::
This will create a project in the helloworld-azure-fn directory that is the same as our artifact ID.
- Go inside the project directory and run mvn clean package
- Next, run mvn azure-functions:run
We should see the following within the output:
- Invoke the following URL: http://localhost:7071/api/HttpTrigger-Java?name=Heartin
We should see the response in the browser as follows: