maven 命令
$mvn clean compile #清理并编译
$mvn clean test #清理并测试,会先编译
$mvn clean package #清理并打包,会先测试
$mvn clean install #清理并安装,会先打包
$mvn archetype:generate #自动生成项目骨架
$mvn dependency:list #当前项目已经解析的依赖信息
$mvn dependency:tree #依赖树
$mvn dependency:analyze #分析当前项目的依赖
$mvn clean deploy #清理并部署到私服或远程,会先打包
$mvn clean deploy -P release #maven #将项目按照指定的release配置构建输出的构建部署到对应的远程仓库
$mvn versions:set -DnewVersion=1.0.1-SNAPSHOT #快速更新自模块项目版本号
$mvn -N versions:update-child-modules #快速更新自模块项目版本号
$mvn versions:revert #回滚
$mvn versions:commit #提交
$mvn clean source:jar install #连带源码打包并安装在本地
$mvn clean install -e -U #打包时强制更新本地仓库并打印详细的异常信息
$mvn clean install -Dmaven.test.skip=true # 跳过单元测试,清理并安装在本地
$mvn install:install-file -Dfile=xxx -DgroupId=xxx -DartifactId=xxx -Dversion=xxx -Dpackaging=jar #将指定的jar包安装在本地
$mvn install:install-file -Dfile=xxx-source.jar -DgroupId=xxx -DartifactId=xxx -Dversion=xxx -Dpackaging=jar -Dclassifier=sources # 打包源码并安装在本地
$mvn deploy:deploy-file -DgroupId=xxx -DartifactId=xxx -Dversion=xxx -Dpackaging=jar -Dfile=xxx -DrepositoryId=Snapshots -Durl=maven-url #将指定的jar包上传到远程仓库
$mvn deploy:deploy-file -DgroupId=alipay-sdk-java -DartifactId=alipay-sdk-java -Dversion=4.14.50.DEV -Dpackaging=jar -Dfile=alipay-sdk-java-xxx.DEV.jar -DrepositoryId=snapshots -Durl=http://mvnrepo.domain.com/nexus/content/repositories/snapshots/ ## 示例
$mvn clean deploy #自动部署到远程仓库,需要配置POM.xml文件
<project>
<distributionManagement>
<!-- release repository -->
<repository>
<!-- 远程仓库的唯一标识 -->
<id></id>
<!-- 可读信息 -->
<name></name>
<!-- 仓库地址 -->
<url></url>
</repository>
<!-- snapshot repository -->
<snapshotRepository>
<id></id>
<name></name>
<url></url>
</snapshotRepository>
</distributionManagement>
</project>
「游客及非Github用户留言」:
「Github登录用户留言」: