partial-build-plugin
partial-build-plugin copied to clipboard
Improve handling of aggregator and parent poms
If you setup your project in a standard parent child relationship as in the example:
- reactor
- child1
- child2
- grandchild1
- grandchild2
- child3
- child4
Any changed file in the toplevel reactor directory results in a full build of every module. This may or may not be necessary. If for instance you changed the Jenkinsfile or some other information-only file like the README, it should not trigger a full build. But if you modified the pom.xml in the reactor and your child poms inherit from that pom, then they most likely need to be rebuilt.
If your top-level pom just contains a list of modules, and is not used as a parent pom, then you should be able to add a module without triggering a rebuild of all the existing modules.
To avoid this problem, it should be possible to separate the aggregator pom and the parent pom:
- reactor
- parent
- child1
- child2
- grandchild1
- grandchild2
- child3
- child4
Such that each child module would refer to the parent pom setting the relativePath = ../parent. The pom in the top-level reactor would just contain the list of modules (a pure aggregator). With this setup, changes to files in the top-level directory do not result in building all modules. But unfortunately, changes to the parent pom will not trigger a build either, unless the parent pom is also added as a module to the reactor. In that case, then any other file additions or modifications to the parent directory will still force a full rebuild of every module, which is not helpful.
My suggestion is to treat the parent pom like any other dependency and only trigger builds if the actual parent pom file was changed. Changes to other files within a directory of a pom where packaging = pom should not trigger a build of that module. This would work for both scenarios, with separate or combined parent and aggregator poms.
This new behavior mode should be optional so users may still use the existing approach. I'd be happy to work on the enhancement, but I wanted to get some feedback on the idea first.
Hi @bfelaco ,
I'll read your feature request in detail and return back to you asap.
Thanks