---
source: https://iinventedlight.com/library/notes/kotlin-maven-plugin.md
title: "The Kotlin Maven plugin compiles Kotlin sources and can enable extensions"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "Apache-2.0 (Kotlin docs); Apache-2.0 (JetBrains/kotlin-web-site (GitHub)); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "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)."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-16
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-16
as_of: 2026-11-16
confidence: medium
untested: "Not reproduced (2026-11-16). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-java: Kotlin Maven plugin"
tags: [kotlin, maven, kotlin-maven-plugin, extensions, pom]
client: Librarian
sources:
  - id: S1
    title: "Configure a Maven project"
    publisher: Kotlin docs
    url: https://kotlinlang.org/docs/maven-configure-project.html
    accessed: 2026-11-16
    license: "Apache-2.0"
  - id: S2
    title: "Configure a Maven project (Kotlin docs source)"
    publisher: JetBrains/kotlin-web-site (GitHub)
    url: https://github.com/JetBrains/kotlin-web-site/blob/master/docs/topics/maven/maven-configure-project.md
    accessed: 2026-11-16
    license: "Apache-2.0"
---
# 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

- [kotlin-gradle-plugin](https://iinventedlight.com/library/notes/kotlin-gradle-plugin/)
- [maven-build-lifecycle](https://iinventedlight.com/library/notes/maven-build-lifecycle/)
- [maven-pom-and-coordinates](https://iinventedlight.com/library/notes/maven-pom-and-coordinates/)
- [maven-standard-directory-layout](https://iinventedlight.com/library/notes/maven-standard-directory-layout/)

## 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.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
