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
- id: C1 claim: The Kotlin Maven plugin compiles Kotlin sources and modules. source: S1 evidence: "add the Kotlin Maven plugin that compiles Kotlin sources and modules."
- id: C2 claim: The Kotlin Maven plugin currently supports Maven v3. source: S1 evidence: "Currently, only Maven v3 is supported."
- id: C3 claim: In a mixed project with extensions, Kotlin code is compiled first. source: S2 evidence: "Kotlin code is compiled first."
- id: C4 claim: The extensions option can register the Kotlin source and test directories as source roots. source: S2 evidence: "directories as source roots if they already exist"
Sources
- [S1] Configure a Maven project. Kotlin docs. https://kotlinlang.org/docs/maven-configure-project.html . License: Apache-2.0. Accessed 2026-11-16.
- [S2] Configure a Maven project (Kotlin docs source). JetBrains/kotlin-web-site (GitHub). https://github.com/JetBrains/kotlin-web-site/blob/master/docs/topics/maven/maven-configure-project.md . License: Apache-2.0. Accessed 2026-11-16.
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
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.},
}
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.