2 January 2026
How to Publish a Gradle Project on Maven Central
You can publish a Java or Kotlin library built with Gradle on Maven Central like this.
First setup your Gradle build to produce a valid bundle for Maven Central.
Include the Maven Publish Plugin in your build.
Setup building of Javadoc and Source archives using Dokka.
Set the required POM metadata in Gradle like this.
See here for a complete working example.
Now you can run gradle publish to create the Maven bundle in the mavenPublish directory (which you probably want to include in .