Let's say I have a multi-module project. There is a parent pom, and then there are 5 projects -- A, B, C, D, and E.
B and C depend on A. D and E depend on B.
Let's say that B receives changes.
How can I build the parent such that it recognizes that only B received changes, and therefore, the only projects that need to built are B, D, and E?
Alternatively, how can I minimize the amount of work done on A and C when the above scenario is in play? I know that running mvn verify
will only do a compilation for B (and maybe D and E?). How can I get it to only do unit tests for them too? Meaning, I don't want A or C to have to compile or do unit tests, nust skip or something like that. Minimize computstion where possible, basically.
Interesting question. Assuming that you know which modules have changes, you can build them e.g. like this:
mvn verify -pl B -amd
where -amd
means:
-amd,--also-make-dependents If project list is specified, also build projects
that depend on projects on the list
You can find out externally, e.g. via git status
or git diff --name-only
and maybe a script reducing the file list to a list of project base directories.
Another option would be to try the mvnmin tool and see if it suits your needs.