Creating Maven 3 Multi Module Projects From Command Line

  1. Execute: mvn archetype:generate
  2. Search for: A_CHANGING_NUMBER: remote -> pom-root (Root project archetype for creating multi module projects)
  3. Use number from #2 as input for the wizzard when maven asks you: "Choose a number: […]:")

If you are working a lot in command line with Maven, take a look at JBoss Forge

But: if you are starting a Java EE 6 project with a multi-module maven module, you should rethink your decision. Start with a single WAR :-)

Comments:

If you're using a recent version of the Archetype plugin, then you can more easily search for "pom-root" at the prompt rather than scanning the output. For example:

Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): 177: pom-root
Choose archetype:
1: remote -> org.codehaus.mojo.archetypes:pom-root (Root project archetype for creating multi module projects)
Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): : 1

Posted by Brett Porter on March 05, 2012 at 10:21 AM CET #

Isn't that a bit overkill to use an archetype to gerenate 7 lines of pom where the only key is to use the right packaging type? ;-)

Posted by P. Cornelißen on March 05, 2012 at 10:30 AM CET #

Even easier :
mvn archetype:generate -Dfilter=pom-root

Or take a look at
mvn archetype:generate -Dfilter=javaee6

Posted by Fred Bricon on March 05, 2012 at 04:47 PM CET #

Post a Comment:
  • HTML Syntax: NOT allowed
...the last 150 posts
...the last 10 comments
License