当前项目有许多模块并且存在父子关系,如下:
<parent>
<groupId>com.boot</groupId>
<artifactId>boot-facede</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>boot-facede-flat</artifactId>
<packaging>jar</packaging>
执行以下命令,升级父项目以及所有子项目的版本:
mvn versions:set -DnewVersion=2.0.0-SNAPSHOT
得到以下结果
<parent>
<groupId>com.boot</groupId>
<artifactId>boot-facede</artifactId>
<version>2.0.0-SNAPSHOT</version>
</parent>
<artifactId>boot-facede-flat</artifactId>
<packaging>jar</packaging>
如果想回退:
mvn versions:revert
revert rely on the
pom.xml.versionsBackup
接下来修改所有被依赖的版本:
mvn versions:update-child-modules
或者
mvn ‐N versions:update‐child‐modules
确认变更
mvn versions:commit
查看更新组件
mvn versions:display-plugin-updates
当项目开发到一定阶段要切换为正式版本时,则执行以下命令:
mvn release:prepare
<parent>
<groupId>com.boot</groupId>
<artifactId>boot-facede</artifactId>
<version>2.0.0-RELEASE</version>
</parent>
<artifactId>boot-facede-flat</artifactId>
<packaging>jar</packaging>
要发布正式版本时则执行以下命令:
mvn release:perform
更多详细官方文档:http://www.mojohaus.org/versions-maven-plugin/usage.html
http://www.mojohaus.org/versions-maven-plugin/examples/set.html
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/14086.html