I am facing a issue where the incremental build option is not working correctly / not building the changes for a maven project.
The basic setup is that the complete branch is checked out from SVN, then a groovy script is run adding all the checked modules to a pom.xml. (see sample pom.xml; note: the projects which contain the changes are present in the pom.xml generated)
Then I would expect the incremental build to put the changed projects after the -pl option of the maven command - but this is not working as expected. I did not find a pattern yet on how this project list is populated.
Executing Maven: -B -f /var/lib/jenkins/jobs/MVNBuildAllModules-4.0.0/workspace/BuildAllPomScript/pom.xml -amd -pl com.company:CHANGED_Moduleclean deploy -U -Djarsigner.skip=true -DskipTests-x
Consider the following log-example:
[EnvInject] - Loading node environment variables.
Building remotely on slave-name in workspace /var/lib/jenkins-slave/remote-root/workspace/MVNBuildAllModules-TRUNK
Updating http://pathfinder/svn/company/trunk at revision '2018-12-18T19:36:04.411 +0100'
U ProjectH3W/src/main/java/com/company/packagename/ChangedJavaClass2.java[...][MVNBuildAllModules-TRUNK] $ groovy /var/lib/jenkins-slave/remote-root/workspace/MVNBuildAllModules-TRUNK/hudson1813316916530204030.groovy
[...]Executing Maven: -B -f /var/lib/jenkins-slave/remote-root/workspace/MVNBuildAllModules-TRUNK/BuildAllPomScript/pom.xml
-amd -pl com.company:ProjectX, com.company:ProjectA, com.company:ProjectZ clean deploy -U -Djarsigner.skip=true -DskipTests_x
Adding module: ... output comes from the groovy script which then creates a <module>../ProjectXYZ</modules> entry in the pom.xml
Assume that ProjectX is dependent on ProjectS and ProjectZ is dependent on ProjectH3W. I would now expect jenkins/maven to build ProjectS, ProjectH3W and als the ones that are dependent (in this short example: ProjectX and ProjectZ) but the -pl option does not necessarily contain all the projects which are changed and also contains some other random projects, which are not in the changelist of SVN.
I assume there is a bug in the plugin which is responsible for adding the changes to the -pl option.