kotlin maven JVM target 1.6. Recompile with -jvm-target 1.8
在使用kotlin 1.3.72时,JDK 11,使用maven来build构建系统是,出现了这样的错误提示:Calls to static methods in Java interfaces are prohibited in JVM target 1.6. Recompile with '-jvm-target 1.8'在kotlin官方文档中,推荐使用属性kotlin.compiler.j
·
在使用kotlin 1.3.72时,JDK 11,使用maven来构建时,出现了这样的错误提示:
Calls to static methods in Java interfaces are prohibited in JVM target 1.6. Recompile with '-jvm-target 1.8'
在kotlin官方文档中,推荐使用属性kotlin.compiler.jvmTarget,然而并不起作用。
最后的解决方法,是在 kotlin-maven-plugin 中添加compile配置,具体如下:
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>compile</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<sourceDirs>
<sourceDir>${project.basedir}/src/main/kotlin</sourceDir>
<sourceDir>${project.basedir}/src/main/java</sourceDir>
</sourceDirs>
<jvmTarget>11</jvmTarget>
</configuration>
</execution>
<execution>
<id>test-compile</id>
<goals> <goal>test-compile</goal> </goals>
</execution>
</executions>
</plugin>
更多推荐
所有评论(0)