Gradle project and settings plugins to
simplify the bootstrapping of Kotlin/Java
projects targeting JVM, Multiplatform (Native/JS/Wasm/Wasi), and GraalVM
native-image. The plugin will take care of configuring most common build tasks, including:
Maven Central
&GHCR
publishing for artifacts & Container image (Jib
)- Code coverage supporting
JVM
,Kotlin Multiplatform
projects - Project Versioning (
SemVer
) based onGit tags
- Code Formatting to enforce a consistent code style
- Artifact Signing
- Java/Kotlin Toolchains configuration
- Target platforms (
JVM
,JS
,WASM
,WASI
,Native
) configuration - Testing & Reports
KSP
& Annotation processorsGraalVM Native
Image- Documentation (
JavaDoc
,Dokka
) - Benchmarking (
JMH
) - API binary compatibility validation
- Deprecated API scanning (using
jdeprscan
) - Builds truly executable JAR files
- Build config generation
- Version catalog to control artifact versions and build configurations
- Automatic configuration of essential dependencies such as:
kotlinx-datetime
kotlinx-coroutines
ktor-client
,kotlinx-serialization
kotlinx-io
Logging
- Automatic configuration of
compiler plugins
likeredacted
kopy
power-assert
atomicfu
- And other common build tasks.
This plugin helps you focus on writing code, not configuring your build. It provides a solid foundation for your Kotlin/Java projects, handling the boilerplate and common tasks so you can get started quickly.
-
Install Java 21 or later
$ curl -s "https://get.sdkman.io" | bash $ sdk i java 21.0.6-zulu
-
Import the Gradle project. The initial sync may take some time as it downloads all dependencies.
Important
For a better, faster experience, use the latest version of IntelliJ IDEA. Upgrade now!
$ ./gradlew build
# Check dep updates
$ ./gradlew dependencyUpdates --no-configuration-cache
For testing, a separate sandbox project is available with the plugin and version catalog applied in
settings.gradle.kts
. First publish the plugin to the local maven repository and then run the sandbox project.
# Publish the plugins to maven local
$ ./gradlew publishToMavenLocal
# Build the sandbox app using published plugin
$ ./gradlew -p sandbox :build -PjvmArgs=
# Run the sandbox app
$ sandbox/build/libs/sandbox-app
# Run other plugin tasks
$ ./gradlew -p sandbox :dependencyUpdates --no-configuration-cache
Push a new tag to trigger the release workflow and publish the plugin
to maven central. That's it 🎉.
The next version will be based on the semantic version scope (major
, minor
, patch
)
$ ./gradlew pushSemverTag "-Psemver.scope=patch"
# To see the current version
# ./gradlew v
# Print the new version
# ./gradlew printSemver "-Psemver.scope=patch"
# For a specific version
# git tag -am "v1.2.3 release" v1.2.3
# git push origin --tags
-
Apply the following config to
settings.gradle.kts
of your projectpluginManagement { resolutionStrategy { eachPlugin { if (requested.id.id.startsWith("dev.suresh.plugin")) { useVersion("<plugin version>") } } } repositories { gradlePluginPortal() mavenCentral() } } plugins { id("dev.suresh.plugin.repos") }
-
Apply the required plugins to
root
orsub
projectbuild.gradle.kts
// Kotlin JVM plugins { id("dev.suresh.plugin.root") id("dev.suresh.plugin.kotlin.jvm") id("dev.suresh.plugin.publishing") // id("dev.suresh.plugin.graalvm") application } // Kotlin Multiplatform plugins { id("dev.suresh.plugin.root") id("dev.suresh.plugin.kotlin.mpp") id("dev.suresh.plugin.publishing") application } kotlin { jvmTarget(project) jsTarget(project) wasmJsTarget(project) wasmWasiTarget(project) nativeTargets(project) {} }
-
Use the version catalog by copying gradle/libs.versions.toml and change the project-related metadata like
group
,app-mainclass
etc.
Important
Don't change the existing version names in the catalog as it's being referenced in the plugins.
The published artifacts are signed using this key. The best way to verify artifacts is automatically with Gradle.
Misc
# Publish to local maven repository
$ rm -rf ~/.m2/repository/dev/suresh
$ ./gradlew publishToMavenLocal
$ tree ~/.m2/repository/dev/suresh
# Publish the plugins to maven central
$ ./gradlew publishPluginMavenPublicationToMavenCentralRepository
# Publish the catalog to maven central
$ ./gradlew :catalog:publishToMavenCentral
$ ./gradlew :catalog:publishAndReleaseToMavenCentral
# Update the Gradle Daemon JVM
$ ./gradlew updateDaemonJvm --jvm-version=21 --jvm-vendor=adoptium