The following are some common scenarios in preparing a release.
Most of the SCMs are simply executed as an external command as the current user on your system. If this username is not the same as the remote username, you may need to set the following option:
mvn -Dusername=your_username release:prepare
These example shows how to set the repository location for all tags to be created in Subversion. Note that it is not needed if you use the standard SVN layout, where the root project is in trunk, and there is a tags directory immediately above it.
<project>
...
<build>
...
<plugins>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<configuration>
<tagBase>https://svn.apache.org/repos/asf/maven/components/releases</tagBase>
</configuration>
</plugin>
</plugins>
...
</build>
...
</project>
Since the release plugin performs a number of operations that change the project, it may be wise to do a dry run before a big release or on a new project. To do this, commit all of your files as if you were about to run a full release and run:
mvn release:prepare -DdryRun=true
This will ask all the same questions, run the same tests, and output a copy of how the POMs will look after transformation. You can check the output and review the POMs, then run:
mvn release:clean
This will remove all of the files created above, and the project will be ready to execute the proper release.
Sometimes it is desirable to do the commit/tag process on a regular interval (eg, to produce nightly or integration builds through a build server). To use the default inputs for the versions and tag information and not prompt for any values, use Maven's --batch-mode setting:
mvn --batch-mode release:prepare