Hot questions for Using Azure in azure devops

Top Java Programmings / Azure / azure devops


I'm trying to build CI/CD for multiple java projects that are contained in one repo with Azure pipelines.

For this purpose was requirement to create one pipeline which will build every project with Maven@3 task. The problem is that when we add new project I want that only this one project was built and not every previous project. My file looks like :

- repo: self
  clean: true
  lfs: true

      - feature/*

  - group: vars

- stage: Build
    vmImage: 'image' 
  - job: Build
      maxParallel: 4
    - task: replacetokens@3
        targetFiles: 'settings.xml'
    - task: Maven@3
        jdkVersionOption: 1.8
        mavenPomFile: 'project1/pom.xml'
        options: '-s $(Build.SourcesDirectory)\settings.xml'
        goals: 'clean package'
    - task: Maven@3
        jdkVersionOption: 1.8
        mavenPomFile: 'project2/pom.xml'
        options: '-s $(Build.SourcesDirectory)\settings.xml'
        goals: 'clean package'

For example project1 is alraedy in develop, so I don't want to do mvn package for it, but only for project2, which is this not merged and has feature branch.

For now this yml won't work because project1 and project2 are in the same repo and this two task will run, which I wan t to avoid.

Is there some way to say "onChange" ???


Unfortunately, this is not possible out of the box which is a shame, to be honest.

The easiest way to handle this would be to create two separate builds. One build for each project you want to build that is located in the same repo and use the path filter like this:

    - master
    - releases/*
    - docs/*
    - docs/

Use step templates and define a single build task or job that you can then use across multiple builds so it is easier to maintain if multiple projects have the same build steps.

Link to the documentation:

There are however guides on the internet where people did some Powershell scripting to achieve the mono repo single build solution.

One example would be this:


I have a Java application that can be deployed to a Tomcat 8 App Service from Eclipse using the Azure extensions.

I created a Build pipeline that creates artifacts with the .war file.

I then created a Release pipeline and set up a "Deploy WAR to Azure App Service". The pipeline deploys the war file and expands it, but some other configuration is not right because the app is not available on the Tomcat server.

Has anyone used this task to successfully deploy to a Tomcat 8 App Service? If so, what else needs to be done to get the app to deploy successfully?

P.S. I have very little experience with Java or Tomcat so it's likely something I've missed.


Well, seems you deployed the WAR to Azure App Service (Azure Website) but not the Tomcat server.

You just need to deploy the WAR to Tomcat server instead of Azure Website.

  1. Build the Java project first, please refer to Working with Azure DevOps and Java and Build your code with Maven for details.
  2. Install the extension Apache Tomcat Deployment
  3. Deploy applications to a Tomcat server using the Deploy to Apache Tomcat task.

Reference below articles to do that:



@Manthan Welcome to StackOverflow. You can use three ways to host your Java Application on Azure:

  1. Create an Azure VM and host your app:

  1. Create a Java app on Azure App Service on Windows

  1. Create an Azure function to host your Java code:

Hope this helps!


I've try to create a pipeline in Azure DevOps. I'm working with Java and Maven, it's a very basic project, just one class/one method and tests.

I've used the maven pipeline template provided by Azure DevOps, but I got a compilation error :

[INFO] -------------------------------------------------------------
[ERROR] Source option 5 is no longer supported. Use 6 or later.
[ERROR] Target option 1.5 is no longer supported. Use 1.6 or later.
[INFO] 2 errors 
[INFO] -------------------------------------------------------------

I don't know what is Source and Target. I looked at in the pom.xml file and in the azure-pipelines.yml file, but I saw nothing about Source and Target.

What is it and how/where can I change it to 6 and 1.6 ?

Furthermore, I'm new with Azure DevOps Pipeline and it's my first project with Maven.

Tell me if you need to see my pom.xml file or my azure-pipelines.yml file for additionnal information, but there are very basic, I changed nothing (the pom.xml file was auto-generated by IntelliJ)

Thanks a lot.


Please have a try to add follow script in the pom.xml file.


For more information, please refer to this issue.