The Maven Cookbook

9.4. Releasing an Artifact

9.4. Releasing an Artifact

Releasing an artifact in Maven comprises of two separated steps which are the release:prepare and the release:perform. The two steps can be manually or automatically by any Continuous Integration system.

9.4.1. Release Prepare

If you think your project reached a particular step of your development the time comes to do a release of your project which simply can be achieved by using Mavens release process. The first step is to do mvn release:prepare in your current state of your project. The release:prepare will check if you missed code changes to check in and take a look at the projects dependencies that it has no SNAPSHOT dependencies and furthermore change the versions in the POMs from X-SNAPSHOT to a new version (you will be prompted for that). The next thing is that the SCM information in the projects POM will be changed to point to the final destination of the tag and all tests will be run against the modified POMs to confirm everything is working fine. Now the modified POMs will be committed and the code in the SCM will be tagged by a version name (prompted for) and change the POMs to use a new version y-SNAPSHOT (these values have been prompted for before) and finally commit the modified POMs into the SCM system.


9.4.2. Release Perform

The release:perform will checkout the code from the previously create tag and run the predefined Maven goals (by default: deploy site-deploy) on it.