POM文件配置
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<configuration>
<!-- 版本自动递增 -->
<autoVersionSubmodules>true</autoVersionSubmodules>
<preparationGoals>clean verify</preparationGoals>
</configuration>
</plugin>
</plugins>
</build>
<!-- maven私服地址,release插件会把release的jar包自动上传 -->
<distributionManagement>
<repository>
<id>nexus-releases</id>
<url>http://47.97.164.125:8081/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>nexus-snapshots</id>
<url>http://47.97.164.125:8081/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
<!-- svn的地址,这三个区别是啥我也不太清楚。maven修改版本后会自动上传 -->
<scm>
<url>https://gitee.com/hzlim/demo.git</url>
<connection>scm:svn:https://gitee.com/hzlim/demo.git</connection>
<developerConnection>scm:git:https://gitee.com/hzlim/demo.git</developerConnection>
<tag>HEAD</tag>
</scm>
注:每个Git仓库都需要配置一个SCM
执行命令
mvn release:prepare -Darguments="-DskipTests"
mvn release:perform -Darguments="-DskipTests"
mvn release:clean
mvn deploy