← All notes

The Kotlin Gradle plugin is applied in the build script plugins block

Answer: To build a Kotlin project with Gradle, add the Kotlin Gradle plugin to your build also script file build.gradle(.kts) and configure the project's dependencies there. To apply the Kotlin Gradle plugin, use the plugins block from the Gradle plugins DSL.

Applying the plugin

In a Kotlin build script, the plugin id is written with kotlin("..."). For a JVM target, that is kotlin("jvm"). In a Groovy build script, the id is org.jetbrains.kotlin.<...> , for example org.jetbrains.kotlin.jvm. The Kotlin Gradle plugin (KGP) and Kotlin share the same version numbering. When you configure the project, check KGP compatibility with available Gradle versions.

JVM target and plugin data

To target the JVM, apply the Kotlin JVM plugin. By default, the plugin stores persistent project-specific data at the also root of the project, in the .kotlin directory also. Do not commit the .kotlin directory to version control. You can change that location with the kotlin.project.persistent.dir property in gradle.properties.

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Kotlin docs, Configure a Gradle project, Apache-2.0 (https://raw.githubusercontent.com/JetBrains/kotlin-web-site/master/LICENSE); JetBrains/kotlin-web-site (GitHub), Configure a Gradle project, Apache-2.0 (https://raw.githubusercontent.com/JetBrains/kotlin-web-site/master/LICENSE). Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Kotlin docs, Configure a Gradle project, Apache-2.0 (https://raw.githubusercontent.com/JetBrains/kotlin-web-site/master/LICENSE); JetBrains/kotlin-web-site (GitHub), Configure a Gradle project, Apache-2.0 (https://raw.githubusercontent.com/JetBrains/kotlin-web-site/master/LICENSE).

Cite this

Permanent ID: iil:note:dpwm22hq

iinventedlight. 2026. "The Kotlin Gradle plugin is applied in the build script plugins block." iinventedlight Library, iil:note:dpwm22hq, version of 2026-11-16. https://iinventedlight.com/library/notes/kotlin-gradle-plugin/. License: CC-BY-4.0.

@misc{iil_note_dpwm22hq,
  author = {{iinventedlight}},
  title = {{The Kotlin Gradle plugin is applied in the build script plugins block}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-16},
  url = {https://iinventedlight.com/library/notes/kotlin-gradle-plugin/},
  note = {Permanent ID iil:note:dpwm22hq. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/kotlin-gradle-plugin.md.