Last week, I needed to push some tiny little open source projects of mine to Maven Central. I’d been avoiding this because I figured it’d be a huge hassle. Turns out, no: it’s easy!

Pretty much everything you need to know is documented in detail here: The Central Repository: OSSRH Guide. In short, though, the process goes like this:

1. File a ticket with the OSSRH project requesting a new repo.
• The ticket I filed for this is OSSRH-22242, which they resolved in less than an hour! Wow.
2. Update your POMs’ <distributionManagement /> section to point at your new OSSRH repos.
3. Ensure that your projects sign their artifacts, using the maven-gpg-plugin.
• With Ubuntu’s GPG keyring integration, I only have to enter my key’s password the first time in a login session.
4. Tweak your POMs a bit to comply with Central’s very reasonable business rules.
• If you mess this up, the repos will give you a very user-friendly error message explaining the problem.
• My first try, I got an error, but just had to go back and add a <developers /> section to my POM. No problem.
5. Optionally, you probably also want to start using nexus-staging-maven-plugin (instead of maven-deploy-plugin). It’s not required, but will make your life easier.
• I tried to avoid this at first, myself. Decided to make the switch, though, because without this plugin I’d have to go in after each release and manually approve/promote the staged artifacts. Somewhat annoying, but happily the nexus-staging-maven-plugincan do that automagically for you.

My projects are organized such that they all inherit from a single parent POM, so that’s where I had to make all of the changes. Here’s a trimmed-down version of what I ended up with:

You can find the full POM here on Maven Central: com.justdavis.karl.jessentials:jessentials-parent:5.0.0:pom.

Many thanks to Sonatype and anyone else involved in the OSSRH repos for making this so simple!