Maven phase order with mulit-module project?

Forgive me. I am noob in Maven.

Here is my maven project directory:

project/
    pom.xml
    moduleA/
    moduleB/
        sub-moduleA/
        sub-moduleB/
        sub-moduleC/
    moduleC/

Of course, in each module and submodule they have their own pom.xml. In addition, in this example moduleBdepends on moduleAand moduleAdepends on moduleC. I know that in maven there are several phases that it goes through, but each time it takes one phase or each module one at a time. Right now, only the three phases that interest me are this compile, packageand install.

For instance:

He does 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 in order 2 :

compile moduleC
package moduleC
install moduleC
compile moduleA
package moduleA
install moduleA
compile moduleB
package moduleB
install moduleB

Or does he do it in a completely different order, or am I just completely in my understanding in maven?

I am running Maven 2.2.1. Thank!

+5
3

2: , ( ), , .

A B, A, B .

+6

snippy, maven. , . , , /, , .

, . -, , . , mojo . , - ( maven 3, - maven 2). , :

  • , . maven-clean-plugin
  • ,
  • , . default-clean

. , , , default-clean, , , .

[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 ---
+2

-, Maven 3, 2, ( -), .

In addition, with regard to assembly order, you should read a little about Maven Reactor , the system responsible for processing multi-module projects.

0
source

All Articles