1.命令
- 构建命令
mvn archetype:generate -DgroupId=zzu-demo(你要创建的groupId) -DartifactId=spring-demo(你要创建的DartifactId) -DarchetypeArtifactId=maven-archetype-webapp(你要创建的项目类型)
- 编译源代码:
mvn compile
- 编译测试代码:
mvn test-compile
- 运行测试:
mvn test
- 产生site:
mvn site
- 打包:
mvn package
- 在本地Repository中安装jar:
mvn install
- 清除产生的项目:
mvn clean
- 生成eclipse项目:
mvn eclipse:eclipse
- 生成idea项目:
mvn idea:idea
- 组合使用goal命令,如只打包不测试:
mvn -Dtest package
- 编译测试的内容:
mvn test-compile
- 只打jar包:
mvn jar:jar
- 只测试而不编译,也不测试编译:
mvn test -skipping compile -skipping test-compile ( -skipping 的灵活运用,当然也可以用于其他组合命令)
2。配置阿里云镜像
在maven安装目录找到<mirrors>
标签,在里面添加如下镜像配置
<mirrors>
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>