Maven3 Issues with building a multi-module enterprise project
- by Sujit K
I just migrated from Maven2 to Maven3 and I'm able to build each module individually or all the modules in one shot by calling mvn clean install. However, in Maven2, since we have multi-module enterprise project, we build multiple ear's and each ear is built as its own module with its own child pom.
To build an individual ear with its dependents, the below command works fine in Maven2 but not in Maven3. Let me explain the issue in Maven3 a bit later.
mvn -pl ear_module -rf first_dependent_module -am clean install
In Maven2 when the reactor lists the build order, I see
first_dependent_module
second_dependent_module
ear_module
End of the day I have my ear module also part of the reactor which is how it should be. The reason we call -rf is we don't want to delete the target folder at the main ${project.basedir} (so not to delete the output created in target from building the other ear modules).
With Maven3, however, this is all I see when the reactor lists the build order:
first_dependent_module
second_dependent_module
Maven3 totally ignores the argument (ear_module) set to -pl flag to be also built after its dependents have been. Not sure what I'm missing here. Any help/tips would be greatly appreciated.
P.S: The build I'm making is similar to the one below....
Build specific module in multi-module project
Thanks,
SK