使用Maven建立父子项目

1.分别使用mvn命令建立俩个一般的java项目和1个web项目

mvn archetype:create   -DgroupId=com.cx  -DartifactId=child1  -DarchetypeArtifactId=maven-archetype-quickstart 

mvn archetype:create   -DgroupId=com.cx  -DartifactId=child2  -DarchetypeArtifactId=maven-archetype-quickstart 

mvn archetype:create  -DgroupId=com.cx -DartifactId=myweb  -DarchetypeArtifactId=maven-archetype-webapp 

2.建立父项目(parent),管理插件(site、tomcat)、报告(javadoc、findbugs、checkstyle等)和依赖。可根据profile指定依赖包的版本。

3.修改pom.xml文件,依赖parent,并新增最外层的pom.xml,可使用profiles包含modules或直接指定modules.

mvn eclipse:eclipse

mvn install -Dmaven.tets.skip=true

mvn clean

猜你喜欢

转载自lgcjava.iteye.com/blog/2001524