Maven3 Issues with building a multi-module enterprise project

Posted by Sujit K on Stack Overflow See other posts from Stack Overflow or by Sujit K
Published on 2010-12-30T00:41:03Z Indexed on 2010/12/30 0:54 UTC
Read the original article Hit count: 248

Filed under:

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

  1. first_dependent_module
  2. second_dependent_module
  3. 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:

  1. first_dependent_module
  2. 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

© Stack Overflow or respective owner

Related posts about maven-3