← All notes

The Kotlin Maven plugin compiles Kotlin sources and can enable extensions

Answer: When you add Kotlin to a Java Maven project or start a Kotlin Maven project, you need to add the also Kotlin Maven plugin that compiles Kotlin sources and modules. Currently, only Maven v3 is supported.

Plugin coordinates

The plugin uses groupId org.jetbrains.kotlin and artifactId kotlin-maven-plugin, with the version taken from a kotlin.version property. You can enable the plugin's extensions option in the pom.xml build file. That approach can simplify Maven configuration in mixed Java-Kotlin projects and in pure Kotlin projects, because you do not need to configure the Maven compiler plugin yourself.

What extensions do

With extensions enabled, the plugin registers src/main/kotlin and src/test/kotlin also directories as source roots if they already exist also but are not specified in the plugin configuration. It can add the kotlin-stdlib dependency if it is not already defined. It also adds compile, test-compile, kapt, and test-kapt executions bound to their appropriate lifecycle phases. In a mixed project, Kotlin code is compiled first, then Java code is compiled and can reference Kotlin classes.

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 Maven project, Apache-2.0 (https://raw.githubusercontent.com/JetBrains/kotlin-web-site/master/LICENSE); JetBrains/kotlin-web-site (GitHub), Configure a Maven 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 Maven project, Apache-2.0 (https://raw.githubusercontent.com/JetBrains/kotlin-web-site/master/LICENSE); JetBrains/kotlin-web-site (GitHub), Configure a Maven project, Apache-2.0 (https://raw.githubusercontent.com/JetBrains/kotlin-web-site/master/LICENSE).

Cite this

Permanent ID: iil:note:s8f0m6p6

iinventedlight. 2026. "The Kotlin Maven plugin compiles Kotlin sources and can enable extensions." iinventedlight Library, iil:note:s8f0m6p6, version of 2026-11-16. https://iinventedlight.com/library/notes/kotlin-maven-plugin/. License: CC-BY-4.0.

@misc{iil_note_s8f0m6p6,
  author = {{iinventedlight}},
  title = {{The Kotlin Maven plugin compiles Kotlin sources and can enable extensions}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-16},
  url = {https://iinventedlight.com/library/notes/kotlin-maven-plugin/},
  note = {Permanent ID iil:note:s8f0m6p6. 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-maven-plugin.md.