Maven: Deploy Java Apps to Azure with Tomcat on Linux

We are pleased to announce a new feature in the Maven Plugin for Azure App Service. The plugin provides seamless integration of Azure services into Maven projects. With only one step, you can deploy your WAR file to Azure Web Apps on Linux with the built-in running stack of Java 8 and Tomcat 8.5 or 9.0. By leveraging Maven, the Azure App Service plugin is portable and can be integrated with your IDEs and CI/CD pipelines easily.

Web apps with Tomcat on Linux

A couple of months ago, we announced the preview release of built-in support for Java 8 and Tomcat 8.5/9.0 on Web Apps on Linux. This allows developers to get their Java apps up and running on Azure in a managed environment, benefitting from auto-scaling and high availability.

Getting started with Maven

After creating a new Azure Web App, choose Linux for OS and Tomcat as stack. Save the information of this new Web App to configurate the Maven plugin. Open the pom.xml file and add the following settings in the <configuration> section.

   <!-- Web App information -->
   <resourceGroup>your-resource-group</resourceGroup>
   <appName>your-app-name</appName>
             
   <!-- Java Running Stack for Web App on Linux-->
   <linuxRuntime>tomcat 8.5-jre8</linuxRuntime>
 
   <!-- Deployment Type -->
   <deploymentType>war</deploymentType>

More detailed configurations are available on GitHub.  

Run it

Open your command line tool and sign in with the Azure CLI 2.0. Type the following command and it will build the project to a .war file and deploy it to your Azure Web App automatically.

$ mvn clean package azure-webapp:deploy

Terminal

It’s done! You can now open a browser to the URL of your app to visit your Java website running on Azure.

Check out our project on GitHub and learn about advanced features of Maven plugin for Azure App Service.

Next steps

More information about building Java apps on Azure:

Feedback

Please share your feedback and ask questions to help us improve below or on GitHub.

Source: Azure Blog Feed

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.