Maven update version numbers of parent and child modules


http://www.cnblogs.com/ilovexiao/p/5663761.html

quote


Maven updates the version numbers of parent and child
modules Preconditions:

1. Install JAVA and MAVEN.

First, you need a pom.xml file with packaging type pom, which is our parent project pom file. Configure in this parent project Good groupId, artifactId, version and properties, prerequisites, dependencies.

Another important configuration item is modules. After adding this project, the version number of the sub-module will be updated when the maven version number update is performed.

The part of the sub-module changed :

<parent>
    <groupId>com.hlf</groupId>
    <artifactId>common-parent</artifactId>
    <version>0.0.1-SNAPSHOT</version>
</parent>
<groupId>com.hlf</groupId>
<artifactId>projectA</artifactId>

found no, here only the version of the parent module is placed and not the submodule.

At this time, we execute:

>mvn versions:set -DnewVersion=0.0.2-SNAPSHOT

will find that in the parent module and the submodule The version control file of maven is generated under the module (let's call it that, Although it appears to be a file backup) pom.xml.versionsBackup.

At the same time, the verion of the parent module and submodule are updated to 0.0.2-SNAPSHOT.

<parent>
    <groupId>com.hlf</groupId>
    <artifactId>common-parent</artifactId>
    <version>0.0.2-SNAPSHOT</ version>
</parent>
<groupId>com.hlf</groupId>
<artifactId>projectA</artifactId>
The version number update of the submodule has been completed here.



What? What else? Then add another command

>mvn versions:update-child-modules

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326230574&siteId=291194637