gitflow-incremental-builder icon indicating copy to clipboard operation
gitflow-incremental-builder copied to clipboard

How to selectively build impacted modules

Open jamesnetherton opened this issue 3 years ago • 1 comments

I created a demo Maven project that is structured like:

├── module-a
├── module-b
├── integration-tests
│   ├── itest-a
│   ├── itest-b
│   ├── itest-c
│   ├── itest-d
│   ├── itest-e

itest-a, itest-c & itest-e all depend on module-a. So I made a change to module-a, ran the build from the project root and the g-i-b plugin correctly identifies the test modules that need to be incrementally rebuilt (a, c & e). Which is great.

Is it possible to specify that I want to build only a specific set of impacted modules? E.g if I only wanted impacted stuff under the integration-tests module to build. Ideally without having to provide multiple -pl arguments. I.e some way of express the modules I want via a regex, a bit like how forceBuildModules works.

jamesnetherton avatar Jun 21 '22 13:06 jamesnetherton

Thing is that -pl is not recursive in Maven 3. In Maven 4 it will become recursive so you could say -pl integration-tests. This question is much related to #328.

If you want to build only impacted modules under integration-tests you can try -rf integration-tests. That will omit module-a though, so it's not a general purpose solution to this.

PS: Also, if anything outside of integration-tests depends on an impacted itest module then it will be built as well.

famod avatar Jun 21 '22 21:06 famod