POM文件配置

  1. <build>
  2. <plugins>
  3. <plugin>
  4. <groupId>org.apache.maven.plugins</groupId>
  5. <artifactId>maven-release-plugin</artifactId>
  6. <version>2.5.3</version>
  7. <configuration>
  8. <!-- 版本自动递增 -->
  9. <autoVersionSubmodules>true</autoVersionSubmodules>
  10. <preparationGoals>clean verify</preparationGoals>
  11. </configuration>
  12. </plugin>
  13. </plugins>
  14. </build>
  15. <!-- maven私服地址,release插件会把release的jar包自动上传 -->
  16. <distributionManagement>
  17. <repository>
  18. <id>nexus-releases</id>
  19. <url>http://47.97.164.125:8081/repository/maven-releases/</url>
  20. </repository>
  21. <snapshotRepository>
  22. <id>nexus-snapshots</id>
  23. <url>http://47.97.164.125:8081/repository/maven-snapshots/</url>
  24. </snapshotRepository>
  25. </distributionManagement>
  26. <!-- svn的地址,这三个区别是啥我也不太清楚。maven修改版本后会自动上传 -->
  27. <scm>
  28. <url>https://gitee.com/hzlim/demo.git</url>
  29. <connection>scm:svn:https://gitee.com/hzlim/demo.git</connection>
  30. <developerConnection>scm:git:https://gitee.com/hzlim/demo.git</developerConnection>
  31. <tag>HEAD</tag>
  32. </scm>

注:每个Git仓库都需要配置一个SCM

执行命令

  1. mvn release:prepare -Darguments="-DskipTests"
  2. mvn release:perform -Darguments="-DskipTests"
  3. mvn release:clean
  4. mvn deploy