Building CI/CD Pipelines for Java Using Azure DevOps (Formerly VSTS)

DZone 's Guide to

Building CI/CD Pipelines for Java Using Azure DevOps (Formerly VSTS)

Visual Studio Team Services has become Azure DevOps. Java devs can learn how to build a release automation pipeline for their web applications.

· DevOps Zone ·
Free Resource

Last week, Microsoft announced their CI/CD solution name change from Visual Studio Team Services to Azure DevOps. Let’s face it, most Java developers cringe and run when they see the term “Visual Studio” with the misconception that the tool will be for .NET users only.  I have to confess; I was one of those guilty Java developers until I discovered that it is actually a powerful solution for any language or platform to utilize during project release cycles.

The Azure DevOps service offers several features for such as adding team members, Kanban boards, Repo options, Build/Release Pipelines, Test Plans, Build Artifacts (e.g. Maven) and much more. It also integrates with your favorite tools like Eclipse, IntelliJ, Jenkins or Chef.  For microservices, Java developers will be happy to know that it supports container build services like Docker, Kubernetes, Cloud Foundry etc.

This tutorial will demo the use of Azure DevOps to set up a release automation to build and deploy a Java web application.


  • Register or log into your Azure DevOps account
  • Copy and save the Git URL for the sample java code from Github
  • Create an Azure Web App (Note: choose the following options for this Java web app. OS = Linux, Runtime Stack = JRE 8)

1. Create a Project and Git Repository

  1. On the Azure DevOps projects page, click "New Project" then enter your project name. 
  2. Select "Git" in the "Version Control" drop-down, then click the "Create" button to continue
  3. Click on the "import" button below the "or import a repository" to paste in the Git URL for the sample Java code above.  Then click on "Import" to continue

Image title

2. Create a Build Definition for Maven

The build definition in Azure DevOps automatically executes all the tasks in the build each time there’s a commit in the Java source application. In this example, Azure DevOps will use Maven to build a Java Spring Boot project.

Click on the Build and Release tab on top of your Azure DevOps project page. Then select the "Builds" link

Click on the New Pipeline button, and then "Continue" to start defining your build tasks

Select "Maven" from the list of templates, then click on the "Apply" button to build your Java project

Image title

Use the drop-down menu for the Agent pool field to select Hosted Linux Preview option.  This informs Azure DevOps which build server to use. You can also use your private customized build server

To configure your build for continuous integration, select the Triggers tab and check the Enable continuous integration checkbox.

Image title

Use the Save & queue drop-down menu to select the Save & queue option

In the pop-up window, verify that "Hosted Linux Preview" is select as the Agent pool field.  Then click on the queue button to build the java application.

Verify that the build tasks completed successfully by clicking on the generated build number.

Image title

3. Create a Release Definition the Java Web App

The release pipeline in Azure DevOps automatically triggers the deployment of build artifacts to any target environment like Azure as soon as the Build process completes successfully. The release pipeline can be created for dev, test, staging or production environments.

  1. Click on the Build and release tab on top of your project page.  Then select the “Releases” link.
  2. Click on the New pipeline button.  On top of the list of templates, then click on the “Empty job” link
  3. Enter a "Stage name" (e.g Dev, Test, Staging or Production).  Then click on the “X” button to close the pop-up window
  4. Click on the "+ Add" button in the Artifacts section.  This will link artifacts from the build definition (e.g. Maven build) to this release definition.  Image title
  5. Use the drop-down menu for the "Source (build pipeline)" to select your build definition. Then click the "Add" button to continue.
  6. Click on the "Tasks" tab on the pipeline.  Then, select your stage name.
  7. Click on the "+" link on the Agent Job section to add a deployment task.
  8. Select  the "Azure App Service Deploy" task under the list of tasks, then click on the "Add" button
  9. On the "Azure App Service Deploy" page, set the version to "4.* (preview)" in the drop-down menu
  10. Use the "Azure subscription" drop-down menu to select your Azure subscription ID.
  11. Select "Web App on Linux" from the "App Service type" drop-down menu
  12. Select the name of the Azure Web App instance you created above in the "App service name" drop-down menu.
  13. For the "Package or folder" field, navigate to the project generated .jar file Image title
  14. Select the "JRE 8" in the "Runtime Stack" drop-down.  Note:  click the refresh button next to the field if you don’t see the JRE 8 in the list.
  15. Click on the "Agent job" link on the left navigation bar.  Select "Hosted Linux Preview" in the Agent pool drop-down menu
  16. To enable continuous deployment, click the "Pipelines" tab
  17. In the Artifacts section, click on the lightning icon.  Then set the "Continuous deployment trigger" to Enabled. Click on the "Save" button, then the "OK" button.Image title
  18. Click on the "+ Release" drop-down menu, then select "Create a release."
  19. In the pop-up window, click on the "Create" button.
  20. Click on the generated “release number” to check the status of your deployment.

4. Test Your Deployed Java Web Application

  1. Open a web browser and paste your web app URL:


2. The web page should display the Spring Music Albums:

Image title


It's nice to see Microsoft making strides to enable all developers by taking simple steps like naming changes that are more attractive and embrace many developer communities. Azure DevOps provides developers and teams with a robust solution to collaborate and automatically generate CI/CD pipelines to deliver applications faster.

java ,devops ,release automation ,spring boot ,vsts ,azure devops ,ci/cd ,tutorial

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}