Skip to content

Latest commit

 

History

History
142 lines (87 loc) · 5.04 KB

File metadata and controls

142 lines (87 loc) · 5.04 KB
title Build and deploy to a Java web app on Linux
description Continuous integration and deployment (CI/CD) to a Java web app on Linux.
ms.topic quickstart
ms.custom devx-track-extended-java, linux-related-content
ms.assetid 49253EA0-9CD6-4082-A303-95F78C7599C2
ms.date 01/15/2026
ai-usage ai-assisted
monikerRange <=azure-devops

Quickstart: Build and deploy to a Java web app

[!INCLUDE version-eq-azure-devops]

In this quickstart, you create an Azure Pipeline that builds and deploys a Java app to Azure App Service on Linux. When you finish, you have a working CI/CD pipeline that automatically builds and deploys your app whenever you push changes to your repository.

You can use Tomcat or Java SE as your runtime.

Tip

If you only want to build a Java app, see Build Java apps.

Prerequisites

[!INCLUDE ecosystems-prerequisites]

Get the code

Select the runtime you want to use.

[!INCLUDE include]

https://github.com/spring-petclinic/spring-framework-petclinic

[!INCLUDE include]

https://github.com/spring-projects/spring-petclinic

Create an App Service plan and app

[!INCLUDE include]

Create an App Service plan and web app on Linux.

# Create a resource group to organize and manage related Azure resources
az group create --location eastus2 --name myapp-rg

# Create an App Service plan with Linux as the operating system
# The plan defines the compute resources for your web app
az appservice plan create -g myapp-rg -n myapp-service-plan --is-linux

# Create a web app using the App Service plan
# Configure Tomcat 10.1 with Java 17 as the runtime environment
az webapp create -g myapp-rg -p myapp-service-plan -n my-app-name --runtime "TOMCAT|10.1-java17"
# Create a resource group to organize and manage related Azure resources
az group create --location eastus2 --name myapp-rg

# Create an App Service plan with Linux as the operating system
# The plan defines the compute resources for your web app
az appservice plan create -g myapp-rg -n myapp-service-plan --is-linux

# Create a web app using the App Service plan
# Configure Java SE 17 as the runtime environment
az webapp create -g myapp-rg -p myapp-service-plan -n my-app-name --runtime "JAVA|17-java17"

Create the pipeline

[!INCLUDE include]

Configure the pipeline

  1. When the Configure tab appears, select Show more, and then select Maven package Java project Web App to Linux on Azure.

  2. You can automatically create an Azure Resource Manager service connection when you create your pipeline. To get started, select your Azure subscription where you created a resource group.

  3. Select Validate and configure. The new pipeline includes a new Azure Resource Manager service connection.

    As Azure Pipelines creates an azure-pipelines.yml file, which defines your CI/CD pipeline, it:

    • Includes a Build stage, which builds your project, and a Deploy stage, which deploys it to Azure as a Linux web app.
    • As part of the Deploy stage, it also creates an Environment with default name same as the Web App. You can choose to modify the environment name.
  4. Make sure that all the default inputs are appropriate for your code.

  5. Select Save and run. You're prompted for a commit message because the azure-pipelines.yml file gets added to your repository. After editing the message, select Save and run again to see your pipeline in action.

Verify the deployment

As your pipeline runs, your build and deployment stages go from blue (running) to green (completed). To watch your pipeline in action, select stages and jobs.

After the pipeline runs, verify your app is running by navigating to your site:

https://my-app-name.azurewebsites.net/petclinic

After the pipeline runs, verify your app is running by navigating to your site:

https://my-app-name.azurewebsites.net


To explore the deployment history for the app, go to the environment. From the pipeline summary:

  1. Select the Environments tab.
  2. Select View environment.

[!INCLUDE include]

Summary

You successfully created an Azure Pipeline that automatically builds and deploys a Java application to App Service. Any changes you push to your repository now trigger the pipeline to build and deploy your updated app.

Related content