Coming from Gradle
Status: 🟡 The manual translations below work for the implemented feature set. ⚪
kargo migrateis planned.
If you know Gradle, the mapping is mostly mechanical. The mental shift is that a build is now data, not code.
Concepts
| Gradle | Kargo |
|---|---|
build.gradle.kts | Kargo.toml |
settings.gradle.kts | [workspace] in the root manifest |
gradle/libs.versions.toml | [catalog] |
gradle.properties | [build-config] and .kargo.env |
gradlew | Nothing — Kargo is one binary |
buildSrc, convention plugins | Hooks and plugins |
| Task graph | Fixed build lifecycle |
productFlavors | [flavors], on every target |
buildTypes | [profile.*] |
| Gradle daemon | None |
Commands
| Gradle | Kargo |
|---|---|
./gradlew build | kargo build |
./gradlew assembleRelease | kargo build --release |
./gradlew test | kargo test |
./gradlew test --tests "*MyTest*" | kargo test --filter MyTest |
./gradlew clean | kargo clean |
./gradlew dependencies | kargo tree |
./gradlew dependencyInsight --dependency x | kargo tree --why x |
./gradlew publishToMavenLocal | kargo publish --repository local |
./gradlew run | kargo run |
./gradlew :app:build | kargo build -p app |
./gradlew --offline build | kargo build --offline |
./gradlew build --scan | kargo build --timings |
A JVM project
// build.gradle.kts
plugins {
kotlin("jvm") version "2.4.21"
application
}
group = "com.example"
version = "1.0.0"
repositories { mavenCentral() }
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.0")
testImplementation(kotlin("test"))
}
kotlin { jvmToolchain(25) }
application { mainClass.set("com.example.MainKt") }
becomes
[package]
name = "my-app"
group = "com.example"
version = "1.0.0"
kotlin = "2.4.21"
main-class = "com.example.MainKt"
[targets.jvm]
java-target = "25"
[dependencies]
kotlinx-coroutines-core = "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.0"
[dev-dependencies]
kotlin-test = "org.jetbrains.kotlin:kotlin-test:2.4.21"
Three things disappeared: the plugin block (targets are declared, not applied), the repository block (Maven Central is the default), and the toolchain call (the compiler version is a field).
A multiplatform project
kotlin {
jvm()
iosArm64()
iosSimulatorArm64()
sourceSets {
val commonMain by getting {
dependencies { implementation("io.ktor:ktor-client-core:2.3.0") }
}
val jvmMain by getting {
dependencies { implementation("io.ktor:ktor-client-okhttp:2.3.0") }
}
}
}
becomes
[targets]
jvm = { java-target = "25" }
ios-arm64 = {}
ios-simulator-arm64 = {}
[dependencies]
ktor-client-core = "io.ktor:ktor-client-core:2.3.0"
[target.jvm.dependencies]
ktor-client-okhttp = "io.ktor:ktor-client-okhttp:2.3.0"
Source sets are not configured at all — the directories already say what they are. See Project Layout.
Dependency configurations
| Gradle | Kargo |
|---|---|
implementation | [dependencies] |
api | [dependencies] — no separate concept |
compileOnly | scope = "provided" |
runtimeOnly | scope = "runtime" |
testImplementation | [dev-dependencies] |
ksp | [ksp] |
kapt | [kapt] |
platform(...) | scope = "import" |
There is no api/implementation split. Gradle uses it to shrink consumers'
compile classpaths; Kargo publishes compile-scoped POMs and relies on Kotlin's
visibility modifiers. If a consumer should not see a type, make it internal.
Version catalogs
# gradle/libs.versions.toml
[versions]
ktor = "2.3.0"
[libraries]
ktor-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" }
# Kargo.toml
[catalog.versions]
ktor = "2.3.0"
[catalog.libraries]
ktor-core = { group = "io.ktor", artifact = "ktor-client-core", version.ref = "ktor" }
Same idea, module split into group and artifact. See
Version Catalogs.
Automated migration
Status: ⚪ Planned.
kargo migrate
Reads build.gradle.kts, settings.gradle.kts, and gradle/libs.versions.toml,
and writes a Kargo.toml plus a report of what it could not translate.
The limits are inherent, not incidental: a Gradle build script is a program, and anything computed at configuration time — a version read from a properties file, a dependency added inside a conditional, a custom task — cannot be expressed as data. Expect the manifest and dependencies to translate, and anything imperative to need a decision.
What does not translate
| Gradle feature | In Kargo |
|---|---|
| Custom tasks | Hooks or subcommand plugins |
doFirst / doLast | Hooks on the nearest lifecycle phase |
| Configuration-time logic | Not supported, by design |
| Dynamic dependency versions | Not supported — versions are exact |
| Composite builds | Workspaces |
| Third-party Gradle plugins | A Kargo plugin, or a hook calling the same tool |
That last row is the real cost of migrating. A build leaning on several Gradle-ecosystem plugins has no drop-in equivalent, and that is a reason to stay on Gradle for that project rather than something to work around.
Running both during a transition
Nothing stops you. Gradle and Kargo read different manifests and write to
different output directories. A pragmatic path: kargo init, get kargo build
and kargo test green, run both in CI for a while, then delete the Gradle files
once nothing depends on them.