Jump to content

ReleasingToMavenCentral

From Wikitech
This page was last updated in 2015 and may be outdated. Please update it if you can.

Maven projects based on the discovery-parent-pom should not follow the instructions below, but instead look at the Building and Release sections of this README.

Walkthrough

  1. Shove ReleasingToMavenCentral/Paranoid.xml into ~/.m2/paranoid.xml
  2. cd your_project
  3. mvn release:prepare
  4. git push --tags gerrit
  5. mvn release:perform
  6. git review
  7. Force everything through gerrit +2/+2
  8. Do the sonatype stuff over at https://oss.sonatype.org/
  9. git checkout <tag version that mvn release:prepare made>
  10. rm -rf ~/.m2/repository_backup; mv ~/.m2/repository ~/.m2/repository_backup
  11. mvn clean install -s ~/.m2/paranoid.xml
  12. Make sure you have Archiva configured
    1. In ~/.m2/settings.xml
    2. In your project's pom.xml
  13. mvn deploy

What can go wrong

git push --tags

If you don't have permission to push tags you'll need to get it granted.

mvn release:perform

If Sonatype gives you HTTP 401s, check your settings file.

~/.m2/settings.xml:

<settings>
  <servers>
    <server>
      <id>sonatype-nexus-staging</id>
      <username>MY_USERNAME</username>
      <password>MY_PASSWORD</password>
    </server>
  </servers>
</settings>

git review

If you never installed the Change-Id-generating commit hook, you'll need to install it, then go back and generate some Change-Ids.

 gitdir=$(git rev-parse --git-dir); scp -p -P 29418 MY_USERNAME@gerrit.wikimedia.org:hooks/commit-msg ${gitdir}/hooks/
 git rebase -i HEAD~2

Change pick to edit, and continue as usual.

mvn clean install -s ~/.m2/paranoid.xml

If one of your dependencies is missing, you'll have to upload those to Archiva's mirrored repository. Make sure that the checksums you have agree with those on http://search.maven.org/