Installation¶
Prerequisites¶
| Requirement | Floor | Notes |
|---|---|---|
| Gradle | 8.11+ | |
| Daemon JVM | JDK 17 | |
| Kotlin Gradle Plugin | 2.2+ | apply kotlin("multiplatform") yourself — the plugin never applies KGP for you |
How the floors are enforced: Compatibility.
Apply the plugin¶
The plugin is published to Maven Central (group com.rsicarelli, artifact kmp-targets-gradle-plugin, plugin id com.rsicarelli.kmptargets). Make sure mavenCentral() is in your plugin repositories:
Then apply it next to KGP in each module:
// build.gradle.kts
plugins {
kotlin("multiplatform")
id("com.rsicarelli.kmptargets") version "0.1.0-SNAPSHOT"
}
kmpTargets {
supports { mobile }
}
Version catalog
With a catalog entry the version lives in one place:
Build-logic that references the DSL types directly depends on the artifact:
// build-logic/build.gradle.kts
dependencies {
implementation("com.rsicarelli:kmp-targets-gradle-plugin:0.1.0-SNAPSHOT")
}
KDoc on hover (IntelliJ)
The plugin ships a sources jar, but IntelliJ does not attach sources for build-script dependencies by default. Enable Settings → Advanced Settings → Build Tools. Gradle → "Attach scripts dependencies sources" (plus "Download sources") and re-sync — hovering supports, mobile, iosArm64, … then shows their documentation.
Consuming snapshots¶
Every push to main publishes a -SNAPSHOT to the Central Portal snapshots repository. To ride the bleeding edge, add the snapshots repo to both plugin and dependency resolution:
// settings.gradle.kts
pluginManagement {
repositories {
mavenCentral()
gradlePluginPortal()
maven("https://central.sonatype.com/repository/maven-snapshots/")
}
}
dependencyResolutionManagement {
repositories {
mavenCentral()
maven("https://central.sonatype.com/repository/maven-snapshots/")
}
}
Snapshot hygiene
Gradle caches changing modules for 24h by default. After a new snapshot lands, refresh explicitly:
If resolution fails with a bare Could not find com.rsicarelli:kmp-targets-gradle-plugin:<version>, the repository list is the first thing to check — snapshots only exist in the snapshots repo, releases only on Maven Central.
Contributing / local development¶
Working on the plugin itself? The repo publishes to mavenLocal() for the sample dev loop:
task publish-local # publishes the plugin (and marker) to ~/.m2
task sample # smoke test against samples/hello-world
This is a contributor workflow — consumers should use Maven Central or the snapshots repo above.
Next: Quick Start →