maven釋出外掛:maven-release-plugin
阿新 • • 發佈:2018-11-26
maven釋出外掛:maven-release-plugin
提供自動化釋出功能,自動升級版本,並將程式碼提交git伺服器
新增外掛依賴,pom.xml配置
配置外掛
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<configuration>
<tagBase >http://git.spt.com/team/supply.git</tagBase>
<connectionUrl>http://git.spt.com/team/supply.git</connectionUrl>
<useReleaseProfile>false</useReleaseProfile>
<autoVersionSubmodules>true</autoVersionSubmodules>
<preparationGoals>clean deploy</preparationGoals >
</configuration>
</plugin>
配置git地址
<scm>
<developerConnection>scm:git:http://git.spt.com/team/supply.git</developerConnection>
<url>http://git.spt.com/team/supply.git</url>
<tag>HEAD</tag>
</scm>
配置nexus地址
<distributionManagement>
<repository>
<id>releases</id>
<name>Internal Releases</name>
<url>http://192.168.2.164:8081/nexus/content/repositories/releases</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>Internal Snapshots</name>
<url>http://192.168.2.164:8081/nexus/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
執行命令釋出:mvn release:clean release:prepare
改命令會升級maven工程版本號,並在git上打好標籤
命令執行過程中會提示輸入新的版本號,以及新的快照號;一路回車即可,外掛會自動升級版本號
建議所有的工程都和parent工程配置一樣的版本號,外掛會自動升級所有的版本號
執行命令回滾:mvn release:rollback
如果釋出遇到問題,可執行該命令回滾版本