I have a multi-module project, in root POM I have:
<modules>
<module>shared-lib1</module>
<module>shared-lib2</module>
<module>main-app</module>
</modules>
In main-app
module I have listed my libraries like that:
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>lib1</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>lib2</artifactId>
<version>${project.version}</version>
</dependency>
The general build command is mvn deploy -pl <changedList> -am -amd
When my Jenkins automation detects change on push to branch, it analyses which files where changed from which module. So, for instance only shared-lib1
is changed.
In that case the command will be mvn deploy -pl shared-lib1 -am -amd
, which will put main-app
into reactor list of projects to build due to -amd
option.
However, it won't pick up shared-lib2
and main-app
will fail to build.
Is there any option to build the tree properly, so basically enable -am
option for all the modules discovered by -amd
?
UPD: ${project.version}
is getting updated each time as contains SHA of commit
As nobody answered this: this is expected behavior of Maven and how it builds the graph of modules. I tried to create my own graph builder, which should have been converted into the Maven builder, but I've moved from this activity long time ago:
https://gist.github.com/vladfau/eb34e4f3892d0207e399a0f1f84f83ff
This was written for Jenkins Pipeline, so has some CPS augmentations. Most notable method is generateFullDependencyList