Skip to content

Instantly share code, notes, and snippets.

@quux00
Last active August 29, 2015 14:07
Show Gist options
  • Select an option

  • Save quux00/952ce6837485b15be7ae to your computer and use it in GitHub Desktop.

Select an option

Save quux00/952ce6837485b15be7ae to your computer and use it in GitHub Desktop.
Notes on publishing Java artifacts to maven central

Information references:

http://datumedge.blogspot.com/2012/05/publishing-from-github-to-maven-central.html

Once you to the mvn release, make sure to follow the instructions in http://central.sonatype.org/pages/releasing-the-deployment.html

After doing that, your artifact will show up in maven central in about 2 hours.

Misc Notes

Had to put gpg.passphase into settings.xml profiles=sign section. That should only be added right before doing a publish; then take it out. I've left it in for now.

Before starting, you first must have an account with: https://oss.sonatype.org

When you do mvn release:prepare (or release:perform, can't remember), it will increment your version number AND push a tag to GitHub. If you make a mistake and abort the release, you'll have to delete this tag both locally and from GitHub.

To remove a tag remotely:
git push --delete origin tagname
To remove a tag locally:
git tag -d tagname

### Publishing releases to maven central Steps:
mvn clean release:prepare
mvn release:perform
For the above you will be prompted for your GitHub GPG password.
After finishing successfully wait about 5 to 10 minutes and then log in to https://oss.sonatype.org
Select Staging Respositories and scroll to the bottom to one called <groupid>-1001 (for me it is netquux00-1001) - the number probably increments with each release.
Click the Close button.
Wait until it changes to closed status. (It may detect errors if you didn't set up your pom correctly.)
Click the Release button.
It should disappear from the Staging Repositories view.
Wait a while (up to 2 hours) and then check for it in maven central.

Note: it will also send email (to the acct you registered with Sonatype)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment