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 .
14 September 2025
Secure your Gradle builds with AppArmor
If you have a Linux system with AppArmor, you can use it to secure your Gradle builds.
Here is how I installed it on Ubuntu Linux:
Make sure you have a Java Development Kit installed.
Set the JAVA_HOME environment variable to point to your JDK by creating a file /etc/profile.d/java.sh with this content:
#!/bin/sh export JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64 Make a manual installation of Gradle in /opt/gradle.
Make it available in PATH:
$ cd /usr/bin $ sudo ln -s .