Maven-插件-統一升級版本號versions-maven-plugin


    在Maven多模塊項目中,版本號升級是個是個比較麻煩的問題。需要你一個一個的升級version。稍微不注意就會丟掉一個很麻煩。所以引入一個新的Maven插件來統一升級版本

步驟一:

    在父工程的pom.xml文件中添加插件 `versions-maven-plugin`

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>versions-maven-plugin</artifactId>
    <version>2.8.1</version>
        <configuration>
            <!--pom不備份-->         
            <generateBackupPoms>false</generateBackupPoms>
        </configuration>
</plugin>

步驟二:

    使用命令進行版本升級

    mvn versions:set -DnewVersion=1.0.0 //升級版本號到1.0.0

    mvn versions:set -DgroupId=com.xxx.xxx -DartifactId=xxx-xxx-xxx -DnewVersion=1.1.8 -DallowSnapshots=true //修改制定模塊版本號

    mvn versions:use-next-releases -DprocessDependencyManagement=false //升級到下一個版本,不要升級dependencyManagement中的版本

    mvn versions:use-next-releases -DprocessDependencies=false //升級到下一個版本,不要升級dependencies中的版本

 

參考:

    1、https://www.jianshu.com/p/e5842a408235

    2、http://www.mojohaus.org/versions-maven-plugin/

    3、https://blog.csdn.net/GGBomb2/article/details/78316068


免責聲明!

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



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