Migrate Maven Central publishing to Central Portal for a Gradle project

Sonatype has deprecated the Legacy OSSRH service that was used to publish Java projects to Maven Central, and turned it off completely on June 30, 2025. The Central Portal was introduced as the new way to publish Java libraries to Maven Central. In order to migrate your Gradle project to this new way of publishing, you need make a few changes to your build scripts and configuration. This article…