Search code examples
mavenazure-devopsazure-pipelinesdevopsazure-pipelines-yaml

Azure pipelines maven multi module project


I've been working on setting up a pipeline for my Java Maven multi-module project in Azure DevOps (the repo is on Azure DevOps). Specifically, I am interested in creating a pull request (PR) and running the pipeline. I'm curious to know if there's a way to execute jobs only for the submodule that has changes. Additionally, I'm wondering if it's possible to utilize PR tags as conditions to run specific jobs or steps.

for example I have a parent pom.xml:

<modules>
        <module>A</module>
        <module>B</module>
        <module>C</module>
        <module>D</module>
        <module>E</module>
        <module>F</module>
  </modules>

and if someone changes the module A, I want to trigger azure pipelines only for the module A, if someone changes the modules A,E , I want to trigger azure pipelines only for A,E .

Do any of you have insights or suggestions on this?

Thank you in advance!

I want to write an azure-pipelines.yml which will compile test package and build image of a multi-module maven project, building only the submodules which have changes


Solution

  • Since all the submodules are in the same source repository, there is not an available way in the pipeline to easily check which submodules are changed and let the jobs only run for the updated submodules.

    In Git repository, the 'git diff' command can get the updated files between commits. However, for your case, it will need to try more complex configurations in the pipeline other than using the 'git diff' command.


    For the PR tags, there is no predefined pipeline variable can fetch the PR tags. So, it seems is not possible to use the tags to the conditions in pipelines.

    If you really need the features, I recommend you try to report a feature request on Developer Community. This way will make it more convenient for the product teams to receive and understand your ideas. And your feedback also could be helpful for improving the Azure DevOps products.