What follows is a description of releasing a Maven project to a staging repository, whereupon it is scrutinized by the community, approved, and transferred 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://people.apache.org/home/YOUR_APACHE_USERNAME/staging-repo/maven-XXX-plugin-Y.Z</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>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<!--plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>clirr-maven-plugin</artifactId>
<executions>
<execution>
<id>clirr-check</id>
<phase>package</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin-->
</plugins>
</build>
</profile>
>mvn deploy ... [INFO] [deploy:deploy] [INFO] Retrieving previous build number from apache.snapshots ...
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 should 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:clean 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.
cd target/checkout mvn site:stage-deploy -Preporting
Note: You should 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 site: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
find . -type d -exec chmod a+rx {} \;
find . -type d -exec chmod g+w {} \;
find . -type f -exec chmod 664 {} \;
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-Y.Z 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
To get the JIRA release notes link, browse to the plugin's JIRA page, select the Road Map link, and use the link to Release Notes that is next to the version being released.
To get the list of issues left in JIRA, browse to the plugin's JIRA page, and from the Project Summary on the right, use the link for Open issues.
Copied from Votes on Package Releases.
Votes on whether a package is ready to be released follow a format similar to majority approval -- except that the decision is officially determined solely by whether at least three +1 votes were registered. Releases may not be vetoed. Generally the community will table the vote to release if anyone identifies serious problems, but in most cases the ultimate decision, once three or more positive votes have been garnered, lies with the individual serving as release manager. The specifics of the process may vary from project to project, but the 'minimum of three +1 votes' rule is universal.
The list of binding voters is available at http://people.apache.org/~jim/projects.html#maven-pmc
Once a vote is successful, post the result to the dev list and cc the PMC. For instance:
To: "Maven Developers List" <dev@maven.apache.org> CC: "Maven Project Management Committee List" <private@maven.apache.org> Subject: [RESULT] [VOTE] Release Maven XXX plugin version Y.Z Hi, The vote has passed with the following result : +1 (binding): <<list of names>> +1 (non binding): <<list of names>> I will move artifacts to central repo.
If the vote is unsuccessful, the process will need to be restarted.
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_APACHE_USERNAME/staging-repo/maven-XXX-plugin-Y.Z" \
-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.
Cleanup
Double check there are no *.rip files left after this process.
find /www/people.apache.org/repo/m2-ibiblio-rsync-repository/org/apache/maven -name '*.rip' -ls
And delete any that you own.
TROUBLE SHOOTING
If you find that stage:copy is hanging at
[INFO] Running rename script on the target machine.
Then this is likely a permission problems. Run
find /www/people.apache.org/repo/m2-ibiblio-rsync-repository/org/apache/maven -name '*.rip' -ls
Then email them the matching users and ask them to run fix-permissions.sh.
(not recommended) 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 the m2-snapshot-repository directory, 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)
cd target\checkout mvn site-deploy -Preporting
Wait for the files to arrive at
http://maven.apache.org/plugins/maven-XXX-plugin
or for a shared component at
http://maven.apache.org/shared/maven-XXX
The wait is necessary to allow the site to be rsync'ed into production.
Check out the maven site project: https://svn.apache.org/repos/asf/maven/site/trunk
If this is a plugin release, update the version number for the plugin on the src/site/apt/plugins/index.apt page.
If this is a shared component release, update the version number for the component on the src/site/apt/shared/index.apt page.
For a plugin, 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.
If this is a shared component, go to Admin section in JIRA for the MSHARED project and mark the maven-XXX-Y.Z version as released. Create version maven-XXX-Y.Z+1, if that hasn't already been done.
Note: You must send this email from your apache email account, e.g. YOUR_APACHE_USERNAME@apache.org otherwise the email to announce@maven.apache.org will bounce.
From: YOUR_APACHE_USERNAME@apache.org 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 should 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
This is a PMC activity. If you are not a PMC member then email the "Maven Developers List" <dev@maven.apache.org> with a request to update this file for your release.
From: YOUR_APACHE_USERNAME@apache.org To: dev@maven.apache.org Subject: [PMC] Maven XXX Plugin Y.Z needs adding to board report The Maven XXX Plugin has been released. Can this get added to the next board report please.
Note: If you don't have access to edit this page email "Jason van Zyl" <jason@maven.org>