A short overview over all steps
- install PGP - that's necessary to sign the artifacts - and upload your public key
- prepare the POM file to satisfy all requirements
- create an Sonatype account
- create a New Project ticket
- wait for a comment.
- perform a stating release and comment the ticket that you have successfully done the stating release and the artifacts are ready to be released.
- wait until the sync to the Maven Central Repository will be activated and now you can do the releases yourself.
- do another staging release
- release your artifacts on this site https://oss.sonatype.org/
- or drop your staging release
- enjoy your artifacts on the Maven Central Repository
1. Install PGP and upload your public key
On this site everything is explained. In short:
- download and install GPG
- $ gpg --version
- $ gpg --gen-key
- enter the required information
- $ gpg --list-keys
- in the output you will see the keyid of the public certificate
- pub 1024D/C6EED57A 2010-01-13
- the C6EED57A string is the keyid
- distribute the public key so that the signed files can be verified
- $ gpg --keyserver hkp://pool.sks-keyservers.net --send-keys C6EED57A
On this site and that site everything is explained. In short:
- the groupId
- if the groupId is at.rseiler.spbee then you need to own rseiler.at.
- if you don't have an own domain, but use GitHub then the groupId must be: github.com/rseiler => com.github.rseiler
- the javadoc.jar must be generated
- the sources.jar must be generated
- all files must be signed with PGP
- following meta data must be provided
- project name, description and URL
- license information
- developer information
- scm (the repository URL)
- the nexus-staging-maven-plugin must be setup
- the distributionManagement (snapshotRepository and
repository) must be setup
The release profile will create the javadoc.jar sources.jar and signs the artifacts. So if you do a release you need to activate the profile with: $ mvn clean deploy -P release
To upload the artifacts you need to setup the settings.xml (.m2/settings.xml).
<settings>3. Create an Sonatype account
Go to this site and create an account.
4. Create a New Project ticket
- go to this site and create a ticket - see mine as an example
- enter the root groupId
- at.rseiler - even if your first artifact uses at.rseiler as groupId
- com.github.rseiler - if you don't have an own domain
- fill out the rest of the fields
- check if everything is setup correctly
- I recommend to set <autoReleaseAfterClose>true</autoReleaseAfterClose> to false so you can check the output first
- notice that there aren't allowed any JavaDoc errors. If there are errors than the javadoc.jar file won't be created and then the requirements are missed.
- $ mvn clean deploy -P release
- check on this site under Build Promation => Repositories => Content your uploaded artifacts
- if everything is fine then use: $ mvn nexus-staging:release to do a stating release
- otherwise $ mvn nexus-staging:drop to drop the stating release
- both commands can be executed on the website, too
- comment the ticket
After the sync is activated you can release your stating-releases yourself to the Maven Central Repository.
8. Enjoy your artifacts on the Maven Central Repository
You have done it! Congratulation! :)
I hope that my blog post helped you and gave you a good overview over all required steps.