# Kotlin 1.5.0 in Maven Multi-Module: java.lang.UnsupportedClassVersionError

**URL:** <https://discuss.kotlinlang.org/t/kotlin-1-5-0-in-maven-multi-module-java-lang-unsupportedclassversionerror/21730>\
**Category:** Support\
**Created:** [May 6, 2021, 12:06pm UTC](https://discuss.kotlinlang.org/t/kotlin-1-5-0-in-maven-multi-module-java-lang-unsupportedclassversionerror/21730 "2021-05-06T12:06:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gopalakshintala](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/gopalakshintala/32/6676_2.png) [@gopalakshintala](https://discuss.kotlinlang.org/u/gopalakshintala)\
**Post date:** [May 6, 2021, 12:06pm UTC](https://discuss.kotlinlang.org/t/kotlin-1-5-0-in-maven-multi-module-java-lang-unsupportedclassversionerror/21730/1 "2021-05-06T12:06:27Z")

</div>

I have a Multi-module Maven project. I had to import a maven module Vader (which uses a mix of Kotlin 1.5.0 and Java 11) and use it as a dependency for one of my modules which purely uses java 11. The code compiles well but at runtime I get this error:  
`java.lang.UnsupportedClassVersionError: org/revcloud/vader/matchers/AnyMatchers has been compiled by a more recent version of the Java Runtime (class file version 59.0), this version of the Java Runtime only recognizes class file versions up to 55.0`

The file for which I get this error is a `.kt` file in my dependency module. I don’t get this error for java files. On the dependency module (vader) I made sure jvmTarget is set to java 11 and jdkHome points to java 11. I even confirmed by running `javap -verbose AnyMatchers.class | grep “major”` which gives me major `version: 55`

I am clueless as to what am I missing, where is this 59.0 coming from? Even my system only has JDK 11 and JDK 15 is not installed. Any hunch what can be the issue?

PFB the `<build>` section of pom.xml for dependency project(vader). (This has lombok too. So I delombok first into target/delombok and kotlin-maven-plugin picks up sources from this place. However none of the lombok annotations are used in Kotlin classes)

```xml
<build>
    <sourceDirectory>${project.build.directory}/delombok</sourceDirectory>
    <testSourceDirectory>${project.build.directory}/delombok-test</testSourceDirectory>
    <plugins>
        <plugin>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-maven-plugin</artifactId>
            <version>${kotlin.version}</version>
            <configuration>
                <jvmTarget>${kotlin.compiler.jvmTarget}</jvmTarget>
                <jdkHome>${kotlin.compiler.jdkHome}</jdkHome>
            </configuration>
            <executions>
                <execution>
                    <id>compile</id>
                    <goals>
                        <goal>compile</goal>
                    </goals>
                    <configuration>
                        <sourceDirs>
                            <sourceDir>${project.build.directory}/delombok</sourceDir>
                        </sourceDirs>
                    </configuration>
                </execution>
                <execution>
                    <id>test-compile</id>
                    <goals>
                        <goal>test-compile</goal>
                    </goals>
                    <configuration>
                        <sourceDirs>
                            <sourceDir>${project.build.directory}/delombok-test</sourceDir>
                        </sourceDirs>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok-maven-plugin</artifactId>
            <version>${lombok.version}.0</version>
            <configuration>
                <encoding>UTF-8</encoding>
            </configuration>
            <executions>
                <execution>
                    <id>delombok</id>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>delombok</goal>
                    </goals>
                    <configuration>
                        <sourceDirectory>src/main/java</sourceDirectory>
                        <outputDirectory>${project.build.directory}/delombok</outputDirectory>
                        <addOutputDirectory>false</addOutputDirectory>
                    </configuration>
                </execution>
                <execution>
                    <id>delombok-test</id>
                    <phase>generate-test-sources</phase>
                    <goals>
                        <goal>delombok</goal>
                    </goals>
                    <configuration>
                        <sourceDirectory>src/test/java</sourceDirectory>
                        <outputDirectory>${project.build.directory}/delombok-test</outputDirectory>
                        <addOutputDirectory>false</addOutputDirectory>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
            <configuration>
                <source>${kotlin.compiler.jvmTarget}</source>
                <target>${kotlin.compiler.jvmTarget}</target>
            </configuration>
            <executions>
                <!-- Replacing default-compile as it is treated specially by maven -->
                <execution>
                    <id>default-compile</id>
                    <phase>none</phase>
                </execution>
                <!-- Replacing default-testCompile as it is treated specially by maven -->
                <execution>
                    <id>default-testCompile</id>
                    <phase>none</phase>
                </execution>
                <execution>
                    <id>java-compile</id>
                    <phase>compile</phase>
                    <goals>
                        <goal>compile</goal>
                    </goals>
                </execution>
                <execution>
                    <id>java-test-compile</id>
                    <phase>test-compile</phase>
                    <goals>
                        <goal>testCompile</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>3.2.0</version>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>3.0.0-M5</version>
        </plugin>
    </plugins>
</build>

```

---

<div class="post-metadata">

**Author:** ![gopalakshintala](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/gopalakshintala/32/6676_2.png) [@gopalakshintala](https://discuss.kotlinlang.org/u/gopalakshintala)\
**Post date:** [May 8, 2021, 4:38am UTC](https://discuss.kotlinlang.org/t/kotlin-1-5-0-in-maven-multi-module-java-lang-unsupportedclassversionerror/21730/2 "2021-05-08T04:38:21Z")

</div>

Figured it out, had to change compiler version in Kotlin plugin

 ![Screenshot 2021-05-07 at 11.22.12](https://us1.discourse-cdn.com/flex019/uploads/kotlinlang/original/2X/9/9b9ef5ef5b4a3b016befef16533cca4940b998b0.jpeg)

---

<div class="post-metadata">

**Author:** ![bjonnh](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/bjonnh/32/8106_2.png) [@bjonnh](https://discuss.kotlinlang.org/u/bjonnh)\
**Post date:** [May 9, 2021, 3:54pm UTC](https://discuss.kotlinlang.org/t/kotlin-1-5-0-in-maven-multi-module-java-lang-unsupportedclassversionerror/21730/3 "2021-05-09T15:54:00Z")

</div>

I wish there would be a warning in the IDE when the versions don’t match. I often had issues due to that.
