当前项目有许多模块并且存在父子关系,如下:
<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:update-child-modules
当项目开发到一定阶段要切换为正式版本时,则执行以下命令:
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