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.
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 \
-Dexpression=project.version
For more details, you can refer to the original thread in Stack overflow.
Hope that helps!
Thank you, @Andreas Schröck !
Patrik S
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.