What follows is a description of releasing a Maven project to a staging repository, whereupon it is scruntized by the community, approved, and transfered to a production repository.
Be sure that:
In order to release a project you must also have the following setup in your $HOME/.m2/settings.xml which is a profile that defines the staging repository.
Here's what your release profile might look like in your $HOME/.m2/settings.xml :
<settings>
...
<profiles>
<profile>
<id>release</id>
<properties>
<gpg.passphrase>secretPhrase</gpg.passphrase>
<deploy.altRepository>apache.releases::default::scp://hostname/path/to/directory/stage/repo</deploy.altRepository>
</properties>
</profile>
</profiles>
...
</settings>
Everything that you need to release has been configured in the POM all Maven projects inherit from. The release plugin configuration being used is the following:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.0-beta-7</version>
<configuration>
<!-- This element will be overriden by children -->
<tagBase>https://svn.apache.org/repos/asf/maven/pom/tags</tagBase>
<useReleaseProfile>false</useReleaseProfile>
<goals>deploy</goals>
<arguments>-Prelease</arguments>
</configuration>
</plugin>
And the profile being used for releases is the following:
<profile>
<id>release</id>
<build>
<plugins>
<!-- We want to sign the artifact, the POM, and all attached artifacts -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<configuration>
<passphrase>${gpg.passphrase}</passphrase>
</configuration>
<executions>
<execution>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- We want to deploy the artifact to a staging location for perusal -->
<plugin>
<inherited>true</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<altDeploymentRepository>${deploy.altRepository}</altDeploymentRepository>
<updateReleaseInfo>true</updateReleaseInfo>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
>mvn deploy ... [INFO] [deploy:deploy] [INFO] Retrieving previous build number from apache.snapshots ...
IMPORTANT NOTE : Be sure that the generated artifacts respect the Apache release rules : NOTICE and LICENSE files should be present in the META-INF directory within the jar. For -sources artifacts, be sure that your pom does NOT use the maven-source-plugin:2.0.3 which is broken. The recommended version at this time is 2.0.4.
Note : You could verify the deployment under Maven Snapshot repository on Apache.
http://people.apache.org/repo/m2-snapshot-repository/org/apache/maven/plugins/maven-XXX-plugin/Y.Z-SNAPSHOT/
Login to people.apache.org, then run:
/www/people.apache.org/repo/m2-snapshot-repository/fix-permissions.sh
This will set maven-metadata.xml file permissions back to 664, and set permissions on any directories you created to 775.
mvn release:prepare
Note : Preparing the release will create the new tag in SVN, automatically checking in on your behalf.
mvn release:perform
The plugin parent pom is configured to stage the documentation in a "versioned" directory such as /plugins/maven-XXX-plugin-Y.Z-SNAPSHOT .
IMPORTANT NOTE : You need to stage the documentation for the current release version.
cd target/checkout
mvn site:stage-deploy -Preporting
Note : You could verify the deployment of the site on the Maven website (you need to wait the sync).
http://maven.apache.org/plugins/maven-XXX-plugin-Y.Z/
Some developers have reported problems with the stage-deploy goal. In that case, you can stage the site locally and upload it manually:
mvn site:stage -Preporting scp -r target/staging/people.apache.org/www/maven.apache.org/plugins/maven-XXX-plugin YOUR_APACHE_USERNAME@people.apache.org:/www/maven.apache.org/plugins/maven-XXX-plugin-Y.Z
To: "Maven Developers List" <dev@maven.apache.org> Subject: [VOTE] Release Maven XXX plugin version Y.Z Hi, We solved N issues: http://jira.codehaus.org/secure/ReleaseNote.jspa?projectId=XXX&styleName=Html&version=XXX There are still a couple of issues left in JIRA: http://jira.codehaus.org/secure/IssueNavigator.jspa?reset=true&pid=XXX&status=1 Staging repo: http://people.apache.org/~YOUR_APACHE_USERNAME/staging-repo/maven-XXX-plugin/ Staging site: http://maven.apache.org/plugins/maven-XXX-plugin-Y.Z/ Guide to testing staged releases: http://maven.apache.org/guides/development/guide-testing-releases.html Vote open for 72 hours. [ ] +1 [ ] +0 [ ] -1
Once a vote is successful, post the result to the dev list and cc the pmc.
Once the release is deemed fit for public consumption it can be transfered to a production repository where it will be available to all users.
Here is an example on how to use the stage plugin:
mvn stage:copy -Dsource="http://people.apache.org/~YOUR_USERNAME/staging-repo" \
-Dtarget="scp://people.apache.org/www/people.apache.org/repo/m2-ibiblio-rsync-repository" \
-Dversion=Y.Z \
-DtargetRepositoryId=apache.releases
Note: The version parameter is currently ignored and the entire staging repository is synced, not just the given version or the current project. It still needs to be provided, though.
Releasing a Project Directly into a Production Repository
If you want to release directly to a production repository then you simply configure the staging repository to point at the production repository by using the following in your $HOME/.m2/settings.xml :
<settings>
...
<profiles>
<profile>
<id>release</id>
<properties>
<gpg.passphrase>secretPhrase</gpg.passphrase>
<deploy.altRepository>apache.releases::default::scp://people.apache.org/www/people.apache.org/repo/m2-ibiblio-rsync-repository</deploy.altRepository>
</properties>
</profile>
</profiles>
...
</settings>
This will allow you to bypass the staging phase and push the release directly into a production repository. It is assumed that you have pushed a snapshot somewhere that people have looked at and approved of.
Login to people.apache.org, then run:
/www/people.apache.org/repo/m2-snapshot-repository/fix-permissions.sh
This will once again set maven-metadata.xml file permissions back to 664, and set permissions on any directories you created to 775. The script lives in m2-snapshot-repository, but it's smart enough to fix permissions in m2-ibiblio-rsync-repository and m2-incubating-repository also.
Note: Be sure to generate and deploy the site using the same version of the release. Typically, you need to check out the tag (or go to target/checkout )
mvn site-deploy -Preporting
Wait for the files to arrive at
http://maven.apache.org/plugins/maven-XXX-plugin
If this is a plugin release, update the version number for the plugin on the /plugins/index.html page.
Go to Admin section in JIRA for the maven-XXX-plugin project and mark the Y.Z version as released. Create version Y.Z+1, if that hasn't already been done.
From: YOUR_APACHE_EMAIL To: announce@maven.apache.org, users@maven.apache.org Cc: dev@maven.apache.org Subject: [ANN] Maven XXX Plugin Y.Z Released The Maven team is pleased to announce the release of the Maven XXX Plugin, version Y.Z This plugin (insert short description of the plugin's purpose). http://maven.apache.org/plugins/maven-XXX-plugin/ You can run mvn -up to get the latest version of the plugin, or specify the version in your project's plugin configuration: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-XXX-plugin</artifactId> <version>Y.Z</version> </plugin> Release Notes - Maven 2.x XXX Plugin - Version Y.Z (Copy Here Release Notes in Text Format from Jira) Enjoy, -The Maven team