maven常用基本命令

1、查看maven版本等信息

mvn --version

2、使用maven打包项目

mvn clean install 

3、打包时跳过单元测试模块

mvn clean install -Dmaven.test.skip=true

4、打包时跳过checkstyle

mvn clean install -Dcheckstyle.skip=true

5、打包时跳过错误module

mvn clean install --fail-never

6、以上命令任意组合联合起来使用,例如跳过测试跳过checkstyle且跳过错误module

mvn clean install -Dmaven.test.skip=true -Dcheckstyle.skip=true --fail-never

7、将jar导入到本地仓库

mvn install:install-file -Dfile=${jar name} -DartifactId=${artifactId} -DgroupId=${groupId} -Dversion=${version} -Dpackaging=jar

例如,将jackson-core-2.9.8.jar导入到本地仓库

mvn install:install-file -Dfile=jackson-core-2.9.8.jar -DartifactId=com.fasterxml.jackson.core -DgroupId=jackson-core -Dversion=2.9.8 -Dpackaging=jar