Insert your widgets from Appearance->Widget


Deploying Open Source artifact to Central Maven

This article is a translation of original article, as english documentation was required for some projects.

We all have build open source artifacts, and always grumbled because it was difficult to deploy them to Central Maven. Hence, we declare repositories in our poms, to explain how to access to our own artifacts !

I’ve search how to do it, I’ve failed to manage it, and then, with a lot perseverance, finally find the way to deploy an artifact to Central Maven ! So, I give you my recipe.

If you want to deploy to Central Maven, it’s not allowed ! You have to deploy to another repository, who will be automatically synchronized with Central. I’ve choosen You have to create an account, you get a login / password.

First, declare this authentication to your ~/.m2/settings.xml :


Then, you’ll need to sign artifacts to make them deployable. Maven has a plugin to sign artifacts, but it requires use – and installation – of GPG. Dependending on your OS, choose the right documentation, the right distribution, create your GPG key and deploy it to a server ; it is explained here. I’ve created a no expire key, to make life simpler.

Once your key created, declare it in your ~/.m2/settings.xml :

 <servers ... />

This will allow you to use your key to sign artifacts from Maven. Your keys are simple files, that can be moved from a computer to another.

Then, you must register your groupId. You should own a domain name, and declare a groupId based on this domain name. Create a JIRA issue on Jira. In Issue type field, choose New Project. Be carefull, it’s not a new project, it’s your groupId root, so a new groupId root. I own, I’ve created an issue for top.marchand/tt>. Once the issue will be processed (48h max), you'll get URI of repositories where you can deploy.

An open source artifact must have various informations, else it’ll be refused. :

  • description
  • url
  • scm

Add these informations to you pom.xml.

Then, you have to declare what you deploy. I deploy only releases, so I’ve decalred this in pom :

  <url>URL sent in JIRA issue</url>

If you want to deploy snapshots, add a snapshotRepository>, with URL sent back in JIRA issue.

Then, I declare a profile to generate sources (it’s an open-source project), javadoc, and to sign artifacts. All of this is required to deploy :


Then, when you want to deploy, just type :

mvn -Prelease deploy

That’s it !

When you deploy, your artifact goes to a staging repository, where it is check. If it does not succeed checks, you’ll be only able to remove it. If you’ve added true in nexus-staging-maven-plugin, it will be automatically moved to a release repository on sonatype, repository synchronized with Central Maven. Else, you have to type

mvn -Prelease org.sonatype.plugins:nexus-staging-maven-plugin:staging:release

or use Nexus web application to convert you artifact to a release.


Written by

The author didnt add any Information to his profile yet