> For the complete documentation index, see [llms.txt](https://docs.konsist.lemonappdev.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.konsist.lemonappdev.com/help/known-issues/maven-module-was-compiled-with-an-incompatible-version-of-kotlin.md). Agents can also search and read this documentation through its [MCP server](https://docs.konsist.lemonappdev.com/~gitbook/mcp).

# Maven: Module was compiled with an incompatible version of Kotlin

Maven projects using Kotlin older than `2.3` fail to compile tests:

```
[ERROR] .../kotlin-compiler-embeddable-2.4.21.jar!/META-INF/org.jetbrains.kotlin_backend.jvm.codegen.kotlin_module: (-1, -1) Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 2.4.0, expected version is 2.1.0.
```

Konsist parses Kotlin files with `kotlin-compiler-embeddable`. Maven adds `runtime` scope dependencies to the test compile classpath, so the project Kotlin compiler reads the metadata of `kotlin-compiler-embeddable`. Kotlin compiler can read metadata only up to one version newer than itself (e.g. Kotlin `2.2` reads metadata up to `2.3`), so Kotlin `2.2` and older can't read `kotlin-compiler-embeddable` `2.4` metadata.

Gradle projects are not affected, because Gradle keeps `runtime` dependencies off the compile classpath.

To fix the issue, use one of these options:

* Upgrade the project Kotlin version to `2.3`+.
* Add the `-Xskip-metadata-version-check` compiler argument to the `kotlin-maven-plugin`:

```xml
<plugin>
    <groupId>org.jetbrains.kotlin</groupId>
    <artifactId>kotlin-maven-plugin</artifactId>
    <version>${kotlin.version}</version>
    <configuration>
        <args>
            <arg>-Xskip-metadata-version-check</arg>
        </args>
    </configuration>
</plugin>
```

{% hint style="warning" %}
The `-Xskip-metadata-version-check` argument disables the metadata version check for all dependencies. Consider moving Konsist tests to a dedicated Maven module, so the argument does not affect other tests (see [Isolate Konsist Tests](https://docs.konsist.lemonappdev.com/advanced/isolate-konsist-tests.md)).
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.konsist.lemonappdev.com/help/known-issues/maven-module-was-compiled-with-an-incompatible-version-of-kotlin.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
