Reference:
http://www.sonatype.com/books/m2eclipse-book/reference/
http://maven.apache.org/plugins/maven-eclipse-plugin/reactor.html
http://yyhh.org/blog/2008/02/create-multiple-modules-maven-project-eclipse
My summary:
- Create the maven project by run the following maven command in *nix shell or windows cmd under the Eclipse workspace:
mvn archetype:create -DgroupId=testgroup -DartifactId=test - Modify the project. Delete the src/ subfolder and then edit the pom.xml to make sure the packaging element in it is set to “pom” instead of the original “jar”.
- Create module. First enter the project folder (cd test); and then run the maven command:
mvn archetype:create -DgroupId=testgroup.module1 -DartifactId=module1 - Create a new project in Eclipse. Two methods can be used depending on the version of m2eclipse:
- For new version of m2eclipse. Click the Eclipse menu: File -> Import -> Maven -> Existing Maven Projects
- For old version of m2eclipse. Run the command:
mvn eclipse:eclipse
and then click the Eclipse menu: File -> New -> Project -> General -> Project, and then click Next, and put the Project name as “test”. Click Finish.