Reputation: 32054
When using Maven with a multi-module project like:
/pom.xml
/project-a/pom.xml
/project-b/pom.xml
If the root POM builds both modules A and B, and B depends on A, when I'm running a mvn package
and I run the build from the root POM:
Q: Does the build for B pull from the current build "reactor" to locate the dependency for A? (ie. the changes in A that are being built) Or does it always go to the local repository?
Basically I'm trying to figure out if I need to be running mvn install
when there are changes in A that B depends on, or whether I can just run mvn package
to save some time.
Upvotes: 5
Views: 1006
Reputation: 97409
If you run it from the root via mvn clean package
or maybe mvn clean verify
(If you have integration tests) the dependencies will be resolved within the reactor.
This means in consequence that you never need to do mvn clean install
. If you ever face the situation that you need to do mvn clean install
on a multi module build that means that your dependencies within the modules are not correct.
And no it will not go to the remote repository for modules which are contained in the reactor.
Upvotes: 3