How to upload your artifacts to Maven Central?

I just applied for access to upload my maven plugin to Maven Central Repository and I would like to outline the steps I have followed. There is already a couple of HowTo pages on the subject but mine will be much shorter. You just have to follow the steps given below in order to have your artifact on the Maven Central.

First of all you need to have a PGP (Pretty Good Privacy) signature known by public signature servers.

Go to GnuPG web site, download and install it on your computer. For linux user it is good old ./configure; make; make check; sudo make install routine. Windows users have the option to download it as a binary. After installation follow the steps given below to have your public key signed.

$ gpg --gen-key
$ gpg --keyserver hkp://pool.sks-keyservers.net --send-keys C6EED57A

To obtain the ID of your generated key, execute the following command.

$ gpg --list-keys
/home/john/.gnupg/pubring.gpg
-----------------------------
pub   2048R/C6EED57A 2011-04-24
uid                  John Doe <john.doe@csi.com>
sub   2048R/C6EED57A 2011-04-24

Now that you have your key signed with public key servers, you can upload your artifacts to Maven Central. Now all you need is to have access to the repo. The easiest way to gain access to Maven Central is via Sonatype OSS Repository. It is an Apache approved repository provided by Sonatype and it helps any OSS (Open-source Software) project to have their artifacts uploaded to Maven Central.

Sign-up to Sonatype JIRA and create a JIRA ticket for access.

You have to choose Community Support - Open Source Project Repository Hosting for the ticket and enter the required information properly. They require you to provide the following information.

  • Summary: a brief introduction of your project
  • groupId : the groupId of your Maven project
  • Project URL : location of the project website
  • SCM URL : location of source control system
  • Nexus Username : the JIRA Username you just signed up, one or more
  • Already Sync To Central : if yes, we will copy those artifacts to Sonatype repository, and rebuild a correct maven-metadata.xml
  • Description

For more information please refer to this guide provided by Sonatype.

After your request is processed they will provide you the repository url’s to upload your artifacts to.

Sign your artifacts and upload to the provided repositories

In order to sign your artifacts you can use maven-gpg-plugin otherwise you have to sign them manually using GnuPG. See the plugin page if you need more information on how to use the plugin.

After you upload your artifact to Sonatype OSS Maven Repository, they will be synced to Maven Central for you.

Read More Post