Thilko Richter bio photo

Thilko Richter

I am a software craftsman with a passion for clean code and continuous learning.

Twitter LinkedIn XING Github Stackoverflow

Recently I was brave enough to publish an artifact to the central maven repository. I didn´t know anything in the beginning and since I knew the process with ruby gems I thought it couldn´t be much work. How naive.

How to release a gem

If you would like to publish a ruby gem you have to:

  1. Register at You will get an api token there which have to be included in your local configuration files.

  2. Setup a project with bundler. Basically you just need a project with a .gemspec file, but bundler is the de facto standard and provides a nice bundle gem command which bootstraps a gem project for you.

  3. Build your gem. gem build creates a gem from your gemspec file.

  4. Install your gem locally You could skip this step if you are keen enough to upload your gem to without integration testing. I wouldn´t recommend it.

  5. Push gem to Here you can use gem push or bundler.

Jeweler or hoe provide some more help around this steps but I think I already easy enough. After pushing, your gem is publicy available.

How to release a maven artifact

Ok, having this steps in mind I started the journey to publish my first maven project. After some investigation I found a general and a gradle guide. Some support from sonatype is available. In short, here are the steps:

  1. Create your maven-like project. Personally I prefer gradle, you don´t have to enter the 90´s maven xml hell.

  2. Sign up on the sonatype repository manager. There is no way to publish an artifact to maven central by yourself. You will need a trusted authority. This could be sonatype.

  3. Sign up on the sonatype ticket system. Create a JIRA ticket for your project, here is an example.

  4. Wait for ticket completion. There is a real(!) person who creates the repositories for you. Afterwards you are able to publish your first snapshots. For me this has worked quite fast. Just a a couple of minutes.

  5. Create a pom that fulfills the requirements. If you are in the luck to use gradle you can use your buildscript to generate the pom´s xml. You will also need to create a sources and javadoc jar.

  6. Sign your maven package. You need to sign your maven package with PGP. I did it with gpgtools. You will need to publish your key to a central location as well. There is a really helpful plugin for gradle.

  7. Publish your first snapshot version. You have snapshot, staging and release repositories. The release repositories are synced every 20 minutes with the central maven repository. You can use your first snapshot versions for testing purposes.

  8. Publish your first staging version The staging repository is used to promote release versions.

  9. Promote staging version Use the nexus repository manager to promote the staged artifact as release version. Nexus will perform various automatic(!) checks if your maven artifact is valid against the required pom structure. If it´s valid, it is promoted as release.

  10. Release your release Comment your JIRA ticket(you remember?) that you promoted your first release. They will check it and activate the automatic sync to the maven central server. Next time your promoted release is synced automatically.

Welcome your project in the java ecosystem! Hooray! Couldn´t be easier… not! Wouldn´t be nice to make the things more e-a-s-y?