Reputation: 1
I have a project with sructure like that:
./pom.xml - parent
./module-1/pom.xml
./module-1/pom.xml
./pom.xml - is an aggregation pom and a parent for ./module-1/pom.xml and ./module-1/pom.xml at the same time.
In this case, there is following building order:
[INFO] parent ............................................. SUCCESS [ 0.332 s]
[INFO] module-1 ........................................... SUCCESS [ 1.794 s]
[INFO] module-2 ........................................... SUCCESS [ 0.165 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
but if ./pom.xml is just aggregation pom and it's not a parent pom for ./module-1/pom.xml and ./module-1/pom.xml than there is a following building order:
[INFO] module-1 ........................................... SUCCESS [ 2.279 s]
[INFO] module-2 ........................................... SUCCESS [ 0.363 s]
[INFO] parent ............................................. SUCCESS [ 0.042 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
another one case:
./pom.xml - aggregation
./parent-pom.xml - parent
./module-1/pom.xml
./module-1/pom.xml
parent-pom.xml - parent pom for ./module-1/pom.xml and ./module-1/pom.xml. pom.xml - aggregation pom.xml for ./module-1/pom.xml and ./module-1/pom.xml and parent for ./parent-pom.xml
[INFO] module-1 ........................................... SUCCESS [ 1.953 s]
[INFO] module-2 ........................................... SUCCESS [ 0.290 s]
[INFO] aggregation ........................................ SUCCESS [ 0.058 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
So I don't understand why does maven reactor change the building order?
I checked documentation and found the following rule:
Because modules within a multi-module build can depend on each other, it is important that the reactor sorts all the projects in a way that guarantees any project is built before it is required.
The following relationships are honored when sorting projects:
a project dependency on another module in the build a plugin declaration where the plugin is another module in the build a plugin dependency on another module in the build a build extension declaration on another module in the build the order declared in the element (if no other rule applies) Note that only “instantiated” references are used - dependencyManagement and pluginManagement elements do not cause a change to the reactor sort order.
But there is nothing here about parent-child relationship. Could anyone explain why the order is changing?
Upvotes: 0
Views: 29