Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

how to build maven dependencies in the in the correct version?

Andreas Schröck February 28, 2023

We have several different projects hosted on bitbucket to develop different parts of a complex framework.

These repositories have interdependencies and all of them are using maven as a build infrastructure.

Currently, we face the issue, that there is an update in one of the projects that is taken into account in another project by updating the pom.xml file.

Now I want to build the project using a pipeline build.

In our current approach, we need to check out the dependency project and build it to be able to access the artefact for the subsequent build step.

It is very nasty to update the checkout step of the pipeline yml file for each update of the pom.xml

Is there an easier way to handle these kinds of depending setups?

It would be ideal to have a pipeline/script that extracts the necessary version from the pom.xml, checks out the repository in the correct version (we use tags with the same name as the current version - e.g. pom.xml - 5.25 --> git tag - 5.25) and builds the artefact.

We are also willing to change our current setup if this would ease our life.

1 answer

0 votes
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 2, 2023

Hello @Andreas Schröck ,

Thank you for reaching out to Atlassian Community!

In this case, I would suggest using a maven plugin or XML parse that would be able to extract the version of the dependency from the pom.xml file and then you could check out the code based on that version, as you mentioned to tag the commit with the same version that is in the POM.xml file.

I did some research and found that there's a maven plugin called Maven help plugin that might be useful for extracting the version interactively using a maven command. This would be the command - using that plugin - to get the version from $project.version in the pom.xml : 

mvn org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate \

For more details, you can refer to the original thread in Stack overflow.

Hope that helps!

Thank you, @Andreas Schröck !

Patrik S

Suggest an answer

Log in or Sign up to answer
Site Admin
AUG Leaders

Atlassian Community Events