JCenter is dead, long live Maven Central

According to Bintray blogpost, Bintray and JCenter are dead effective May 2021. That’s too bad - I’ve been using Bintray to avoid Maven Central ridiculously complex deployment process. Looks like that can not be avoided anymore.

Here I’ve summarized the steps which a Gradle-based project needs to take in order to be published successfully onto Maven Central.

The Painful: Initial Set of Steps

First, read the How to publish artifact to Maven Central via Gradle blog post, it’s a good starter and explains the entire process in a sane way. Read it until the section “5.Set up your project to upload” and stop there; the com.bmuschko plugin is not needed, in fact it’s easier to not to use the plugin. A couple of remarks:

  1. I’ve put the signing key credentials and Sonatype nexus username/password into the ~/.gradle/gradle.properties. That way, I will never commit the file accidentally into git and publish into github.
  2. If you’re stuck with the OSSRH registration, this blogpost can help: How to publish artifacts on maven central.
  3. You may need to publish the GPG key on a couple of key servers; the official Maven Central: Working with PGP Signatures documentation suggests hkp://pool.sks-keyservers.net.
  4. Interesting - the key doesn’t have to be signed by anyone from Sonatype, which sounds like anyone can generate those keys… well /shrug.

In order to sign the artifact and upload it to Maven Staging Repository please use the signing plugin and maven-publish plugin.

A couple of tips:

  • The Maven Central infrastructure seems to be not always… responsive. I often got build failures due to timeouts. Life-saving tip from DanySK maven central gradle plugin: place the following into ~/.gradle/gradle.properties:


Releasing is far simpler luckily. Running

./gradlew clean build publish

will upload your project into a new fresh staging repository. You then need to close the repository and publish it. This process is simple but LONG and can easily take 1 hour since https://oss.sonatype.org is SLOOOOW.

The releasing steps are as follows:

  1. Run ./gradlew clean build publish to publish to a fresh staging repo.
  2. Visit https://oss.sonatype.org
  3. Open “Staging Repositories”; continue according to Releasing deployments

Official Guide

The official guide is ridiculously long and links to videos which are ridiculously long: OSSRH-Guide. You can read it if you’re hopelessly stuck, otherwise just ignore.

Written on February 8, 2021