maven 批量更新版本號


在maven項目中,多模塊開發是比較常見的。各個子模塊和父模塊的版本號保持一致,那父模塊版本號變化后,有沒有什么辦法能把子模塊的版本號一起更新呢?

在Spring Boot中的spring-boot-dependencies中的pluginManagement已經添加了該插件,所以spring boot項目我沒有添加插件,可以直接用,如果不行,請嘗試添加插件。

1. 更新版本號:mvn versions:set -DnewVersion=3.0.0

2. 回滾: mvn versions:revert

3. 提交: mvn versions:commit

 

非spring boot項目,需在父pom中添加以下插件:

 <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>versions-maven-plugin</artifactId>
      <version>2.7</version>
      <configuration>
         <generateBackupPoms>false</generateBackupPoms>
      </configuration>
 </plugin>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM