Search code examples
javamavenmaven-central

How exactly do you get a JAR into Maven Central


I have built a JAR and want to put it into Maven Central. How do I actually do that?

I have reviewed the instructions here:

https://maven.apache.org/guides/mini/guide-central-repository-upload.html

This has got to be the worst set of instructions I have ever seen. Seriously, try reading it.

These instructions make no sense to me. They are basically impossible to understand. Can someone please share with me a simple plain-English set of steps for how to actually get your JAR into Maven Central? Would really appreciate it.


Solution

  • Like explained between the lines on that page, you need a supported repository hosting location to be able to get your artifact into maven central. Since there is only a handful of such locations, the best bet to get something in there is to have it as open source release, as those have an open one:

    The easiest way to upload another project is to use the Open Source Software Repository Hosting (OSSRH), which is an approved repository provided by Sonatype for any OSS Project that want to get their artifacts into Central Repository.

    That's what I've used as well. Refer to their instructions for details. In short, you need to

    • create a jira ticket for your project and get it approved
    • deploy your artifact (fulfilling the requirements, using either Maven or some other deployment tool) to their private staging area
    • promote the release to release area

    If all goes well, after the last step the release will be synced to maven central in roughly ten minutes.