Maven versioning best practices [closed]

You should use the maven-release-plugin to release your artifacts. Than automatically all your versions will be incremented by the release-plugin. The exception might be if you are going from 1.0.3-SNAPSHOT to 1.1.0-SNAPSHOT .
The timeline for developing with Maven is:

1.0.0-SNAPSHOT
1.0.0
1.0.1-SNAPSHOT
1.0.1
1.0.2-SNAPSHOT
1.0.2
..

To go for the step from a SNAPSHOT to a release version you should use the maven release plugin you can release an artifact simply by using:

First step:

mvn release:prepare 

The final step:

mvn release:perform

If you would like to accept the defaults you can simply add -B like:

mvn -B release:prepare 

or you can combine those steps into a single one:

mvn -B release:prepare release:perform

The above can also be used from within a CI solution.

Using mvn install is only intended to install the artifacts into your local repository. If you are working with a real one like a repository manager (which i can recommend) you have to use:

mvn deploy 

One requirement for using the release plugin is to configure the scm area in your pom (i hope you are using a version control?).

Leave a Comment