Publishing to Maven Central#
The Maven Central Repository service by Sonatype, known in the community as “Maven Central”, is one of the most popular repositories for publishing open source libraries and other distributable artifacts in the Java and Kotlin ecosystems.
Many developers who use Gradle publish their open source projects to Maven Central. The publishing flow for Maven Central differs significantly from publishing to a generic Maven repository using the Maven Publish Plugin. It involves additional requirements for the artifacts themselves (such as metadata files and signed JARs), as well as for the publishing process (including a staging workflow and server-side verification). Hence, this solution page provides some tips and references.
Plugins for publishing to Maven Central#
As of now, there is no officially recommended plugin for publishing to Maven Central. However, a variety of community-supported plugins and tools are available on the Gradle Plugin Portal. Below are some of the most popular options plugins, ranked by GitHub stars and having more than 10 stars:
- vanniktech/gradle-maven-publish-plugin
- JReleaser
- GradleUp/nmcp
- deepmedia/MavenDeployer
- DanySK/maven-central-gradle-plugin
- yananhub/flying-gradle-plugin
Note that not all listed plugins are actively maintained, and one has to choose carefully based on their use cases. See the recommendations below.
Breaking Changes in Maven Central on June 2025#
As announced by Sonatype, the Sonatype OSS Repository Hosting service (OSSRH) will reach end-of-life on June 30th, 2025. OSSRH is an old and deprecated component of the Maven Central Repository service.
With the sunset of OSSRH, Maven Central is transitioning to a new hosting implementation, which includes a complete redesign of its APIs. As a result, Maven Central publishing plugins must be updated to remain compatible once the OSSRH compatibility layer is removed in June 2025.
We invite the plugin maintainers to update their plugins and add support for the new APIs.
Compatible Plugins#
Several plugins already report compatibility with the new APIs, and new plugins have been developed specifically for the updated implementation. Among the plugins listed above, the following are known to be mostly compatible based on their changelogs:
- vanniktech/gradle-maven-publish-plugin (common and base versions)
- JReleaser
- GradleUp/nmcp
Choosing a plugin for Maven Central publishing#
Choosing the right plugin might be non-trivial, as they have different feature sets and might include different developer experiences in your particular publishing use case. For common Java and Kotlin projects that do not include custom artifacts and distributions, the following selection algorithm can be considered:
- If you want to automate the whole release process (packaging, signing, changelog generation, etc.) in a single call and are ready to follow conventions, consider using JReleaser.
- If you want only a publishing step that follows Maven Central conventions, use vanniktech/gradle-maven-publish-plugin in the default configuration. It can publish your Java, Android, and Kotlin libraries, including sources and documentation, to Maven Central or any other Nexus instance.
- If you want to customize the whole publishing flow, e.g., for staging or custom artifact types, use GradleUp/nmcp or com.vanniktech.maven.publish.base.
> DISCLAIMER: This algorithm does not represent an official endorsement by Gradle, Inc. Your mileage may vary, and there are other plugins out there.
References#
- Deploying to OSSRH / Maven Central with Gradle - official documentation page on the Maven Central Documentation site
- GSoC 2025 - Maven Central publishing for Gradle with new APIs - Google Summer of Code 2025 project targeting the problem area
Discuss#
To support this effort, we have created a new #maven-central-publishing channel on the Gradle Community Slack.