Maven Central is the de-facto repository for hosting software artifacts that compile to the JVM.
It is one of the world’s largest and oldest archives of software libraries.
In this post, I’ll describe the process of releasing a new artifact in Maven Central following a step-by-step approach.
Create a JIRA ticket in Sonatype
First, you need to create a JIRA account and submit a ticket there requesting for a project namespace in Sonatype (aka, GroupId):
A staging repository is already configured for the requested GroupId, you need to find someone with a deployer role that comments on the ticket to verify your request.
Below is an example of a ticket that I created requesting a repository for the namespace se.kth.castor
The ticked review is a manual process, it normally takes less than 2 business days.
Configuring the POM
After the approval of the ticket, you need to add additional information to the POM of the Maven project or module to be deployed. Follow the steps below exactly as they are.
Follow these instructions to encrypt your artifact with gpg2 and distribute your public key to a key server (e.g., http://keys.gnupg.net). Do not forget to choose a passphrase to protect your secret key. Then add your gpg credentials with your passphrase to your Mavensettings.xml file locally and use the Sonatype Nexus repository manager as the server :
Finally, run a deployment to OSSRH and an automated release to the Central Repository with the following command:
1
mvn clean deploy
After this, Central sync will be activated for your namespace. After you successfully deploy, your component will be published to Maven Central, typically within 10 minutes, though updates to search.maven.org can take up to two hours.
If you have any issue, let me know in the comments below. Happy deploying