Skip Navigation

Releasing Software with Maven

Chapter 9

9.1 Introduction

In Maven existing four different possibilities to release an artifact. The release of an artifact has different meaning in different areas where you release an artifact.

9.2. Install Artifact

Installing an artifact means to deploy an artifact into the users Maven repository (~/.m2/repository). This makes it possible to use an artifact as a dependency for an other project by this user on the same machine.

9.3. Deploying Artifact

Deploying is meant to be releasing an artifact (SNAPSHOT) into a repository outside users machine which means to make it usable by others of the team into their projects.

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.