Gradle publishing to Maven Central frustration

Setting the scene

Our "clocks" implementations are generally applicable, so I decided to open source them. They are also a dependency for tg-eventstore, which we aim to open source too.

I'd never published to Maven Central before, and in fact no-one had published to our groups for a year or so.

Gradle changes

Gradle's publication system started changing significantly around Gradle 1.7.

New publications { } block and maven-publish plugin

Positive changes?

The updated Maven publishing plugin makes it easier to configure the POMs produced, especially in multi-artifact projects.

As part of updating code bases to use Gradle 3-4, started using maven-publish too

Beta limbo

The new publications mechanism was introduced in Gradle 1.5 or 1.7, and has been "in incubating" ever since.

The maven-publish plugin doesn't support signing artifacts for upload.

The docs suggest to keep using the old maven plugin to push to Maven Central.

Pushing ahead

It's simple to push to a local file: location

Once you have the files laid out in a local Maven repo format, can post-process to bundle them

Delivery to Sonatype

There is an API, but good luck finding documentation.

Lots of "just run this Maven command", or "just use the Gradle maven plugin"

Manual delivery

You can use the web interface to upload bundles.

In fact, this just drives a local Nexus API - so easy to reverse-engineer it.

Current state

A script in the clocks repo to publish to a local filesytem, and push the bundles to Sonatype

Still requires manually going to the web interface and clicking "release" on the staging repositories

Future state

Download artifacts from our Nexus and "promote" them to Sonatype?

Maybe promoting to Maven Central doesn't really belong in Gradle at all