Events
Mar 17, 11 PM - Mar 21, 11 PM
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
This article shows you how to create a serverless function project with the Eclipse IDE and Apache Maven, test and debug it, then deploy it to Azure Functions.
If you don't have an Azure subscription, create an Azure free account before you begin.
To develop a functions app with Java and Eclipse, you must have the following installed:
Important
The JAVA_HOME environment variable must be set to the install location of the JDK to complete this quickstart.
It's highly recommended to also install Azure Functions Core Tools, version 2, which provide a local environment for running and debugging Azure Functions.
resourceGroup
, appName
, and appRegion
(please use a different appName other than fabrikam-function-20170920120101928), and eventually Finish.
Maven creates the project files in a new folder with a name of artifactId. The generated code in the project is a simple HTTP triggered function that echoes the body of the triggering HTTP request.
Note
Azure Functions Core Tools, version 2 must be installed to run and debug functions locally.
package
in the Goals, then select Run. This will build and package the function code.azure-functions:run
as the goal and name. Select Run to run the function in the IDE.Terminate the runtime in the console window when you're done testing your function. Only one function host can be active and running locally at a time.
In your Run As configuration set up in the previous step, change azure-functions:run
to azure-functions:run -DenableDebug
and run the updated configuration to start the function app in debug mode.
Select the Run menu and open Debug Configurations. Choose Remote Java Application and create a new one. Give your configuration a name and fill in the settings. The port should be consistent with the debug port opened by function host, which by default is 5005
. After setup, click on Debug
to start debugging.
Set breakpoints and inspect objects in your function using the IDE. When finished, stop the debugger and the running function host. Only one function host can be active and running locally at a time.
The deploy process to Azure Functions uses account credentials from the Azure CLI. Log in with the Azure CLI before continuing using your computer's command prompt.
az login
Deploy your code into a new Function app using the azure-functions:deploy
Maven goal in a new Run As configuration.
When the deploy is complete, you see the URL you can use to access your Azure function app:
[INFO] Successfully deployed Function App with package.
[INFO] Deleting deployment package from Azure Storage...
[INFO] Successfully deleted deployment package fabrikam-function-20170920120101928.20170920143621915.zip
[INFO] Successfully deployed Function App at https://fabrikam-function-20170920120101928.azurewebsites.net
[INFO] ------------------------------------------------------------------------
azure-functions:add
Maven target.Events
Mar 17, 11 PM - Mar 21, 11 PM
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowTraining
Module
Deploy a simple Java Web App to Azure App Service - Training
Learn how to create a Java web application and deploy it to Azure App Service.
Certification
Microsoft Certified: Azure Developer Associate - Certifications
Build end-to-end solutions in Microsoft Azure to create Azure Functions, implement and manage web apps, develop solutions utilizing Azure storage, and more.
Documentation
Create a Java function from the command line - Azure Functions
Learn how to create a Java function from the command line, then publish the local project to serverless hosting in Azure Functions.
Create a Java function using Visual Studio Code - Azure Functions
Learn how to create a Java function, then publish the local project to serverless hosting in Azure Functions using the Azure Functions extension in Visual Studio Code.
Create a Java function in Azure Functions using IntelliJ
Learn how to use IntelliJ to create an HTTP-triggered Java function and then run it in a serverless environment in Azure.