Forgive me. I'm a noob at Maven.
Here is my maven project directory:
project/
pom.xml
moduleA/
moduleB/
sub-moduleA/
sub-moduleB/
sub-moduleC/
moduleC/
Of course, within each module and sub-module, they have their own pom.xml
. Also, in this example moduleB
depends on moduleA
and moduleA
depends on moduleC
. I know in maven there are multiple phases it goes through, but does it take each phase one at a time, or take each module one at a time. Right now, the only three phases I'm concerned with is compile
, package
, and install
.
For example:
Does it do it in Order 1:
compile moduleC
compile moduleA
compile moduleB
package moduleC
package moduleA
package moduleB
install moduleC
install moduleA
install moduleB
Or does it do it in Order 2:
compile moduleC
package moduleC
install moduleC
compile moduleA
package moduleA
install moduleA
compile moduleB
package moduleB
install moduleB
Or does it do it in a totally different order, or am I just completely off in my understanding in maven?
I'm running Maven 2.2.1. Thanks!
Order 2 : The reactor detects all the projects, build a sorted list to build the projects in the right order (respecting dependencies), and then builds the projects, following this order.
If A depends on B, you cannot start to build A if B is not totally processed.
I don't mean to be snippy, but you should familiarize your self with the maven output. It really does tell you precisely what it's doing. It will tell you precisely the order in which it will build the modules, and then it will tell you precisely the phase / executions that are going on while it builds each.
For instance, here's a simplified built report. First, it tells you what project its building. Then, for each phase there's a report about which mojo execution is occuring. Note that the execution lines start and end with three --- ( this is maven 3; it's different in maven 2 ). And note that it tells you:
maven-clean-plugin
default-clean
Note, all of the executions that are the default binding for the lifecycle phases, i.e. the built in executions, have a name like default-clean
where the phase is identified, as well as the fact that it's the default.
[INFO] ------------------------------------------------------------------------
[INFO] Building common-utilities 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.3:clean (default-clean) @ common ---
SNIP
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ common ---
SNIP
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ common ---
SNIP
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ common ---
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With