Gradle project and settings plugins that
simplify bootstrapping Kotlin/Java
projects targeting JVM, Multiplatform (Native/JS/Wasm/Wasi), and GraalVM
native-image. These plugins handle configuring the most common build tasks, including:
Maven Central
&GHCR
publishing for artifacts & container images (Jib
)- Code coverage for
JVM
andKotlin Multiplatform
projects - Project versioning (
SemVer
) based onGit tags
- Code formatting to enforce consistent code style
- Artifact signing
- Java/Kotlin toolchain configuration
- Target platform (
JVM
,JS
,WASM
,WASI
,Native
) configuration - Testing & reports
KSP
& annotation processorsGraalVM Native
image- Documentation (
JavaDoc
,Dokka
) - Benchmarking (
JMH
) - Binary compatibility (
ABI
) validation - Deprecated API scanning (using
jdeprscan
) - Building truly executable JAR files
- Build configuration 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
such as:redacted
kopy
power-assert
atomicfu
- And many other common build tasks
These plugins help you focus on writing code, not configuring your build. They provide 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 the best and fastest experience, use the latest version of IntelliJ IDEA. Upgrade now!
$ ./gradlew build
# Check dependency updates
$ caupain --gradle-stability-level=milestone
# OR
$ ./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, then run the sandbox project.
# Publish the plugins to Maven local
$ ./gradlew publishToMavenLocal
# Build the sandbox app using the published plugin
$ ./gradlew -p sandbox :build
$ sandbox/build/libs/sandbox
# Run other plugin tasks
$ ./gradlew -p sandbox :dependencyUpdates --no-configuration-cache
# To see the plugin classpath
$ ./gradlew -p sandbox :buildEnvironment | grep -i "dev.suresh"
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 configuration to
settings.gradle.kts
of your project:pluginManagement { 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 your
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") } kotlin { jvmTarget(project) jsTarget(project) wasmJsTarget(project) wasmWasiTarget(project) nativeTargets(project) {} }
-
Use the version catalog by copying gradle/libs.versions.toml and changing the project-related metadata like
group
,app-mainclass
, etc.
Important
Don't change the existing version names in the catalog as they are referenced by 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 publishToMavenCentral
# Update the Gradle Daemon JVM
$ ./gradlew updateDaemonJvm --jvm-version=21 --jvm-vendor=adoptium