Gradle originally used Groovy for build scripts (build.gradle) — dynamically typed, with limited IDE support for catching mistakes before running the build. build.gradle.kts, Gradle's Kotlin DSL, is now the standard choice for new projects: the same statically-typed benefits Kotlin brings everywhere else apply directly to the build script, including full autocomplete and compile-time errors for a misspelled configuration option. Version catalogs (gradle/libs.versions.toml) centralize every dependency's version in one shared file, referenced consistently across every module in a multi-module project, rather than duplicating version strings throughout many build files.
build.gradle.kts: a typed, IDE-friendly build script
Misspelling implementation as implemantation, or a dependency coordinate, is caught immediately by the IDE here — the equivalent mistake in the older Groovy DSL often wouldn't surface until the build actually ran and failed.
plugins {
kotlin("jvm") version "2.4.0"
application
}
dependencies {
implementation("com.squareup.okhttp3:okhttp:4.12.0")
testImplementation(kotlin("test"))
}
application {
mainClass.set("com.example.MainKt")
}Version catalogs: one shared source of truth
Every module in a multi-module project references libs.okhttp instead of repeating the exact version string — updating one entry in the catalog updates it everywhere it's used, avoiding version drift between modules.
[versions]
okhttp = "4.12.0"
[libraries]
okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" }dependencies {
implementation(libs.okhttp) // references the catalog entry, not a hardcoded version
}Multi-module project structure
settings.gradle.kts declares which modules exist; each module gets its own build.gradle.kts, letting a large project split cleanly into independently-buildable pieces (a shared library, an app module, and so on).
rootProject.name = "my-project"
include(":app", ":shared-lib")