Control module version with Maven

7

I have a Java multi-module project with Maven.

I currently control the version of each module manually by editing the <version> element of the pom.xml of each module that undergoes updates.

I believe this is not the correct / indicated method. Is there anything automated for this?

    
asked by anonymous 14.01.2014 / 17:28

1 answer

6

If all your projects are controlled at the same pom, create a property:

<project ...>
    <properties>
        <my.project.version>1.0</my.project.version>
    </properties>
</project>

And then use wherever you want as:

<version>${my.project.version}</version>

Another way to do this automated version closing is by using the maven release plugin ( link ).

In this case, firing mvn release:prepare maven will simulate a version lock for you. This will change the version of the artifacts (everyone with SNAPSHOT, it will ask if you want to do the tag) and commit in SVN.

After prepare is successfully completed, you execute the command mvn release:perform that commits the changes.

This plugin can integrate with SVN and also with JIRA.

If an error occurred, you can use mvn:rollback to undo changes.

More details look at the links below: link link

    
14.01.2014 / 17:34