JavaEar 专注于收集分享传播有价值的技术资料


  1. You can fix this issue as follows:

    • Open the IntelliJ preferences
    • Go to Build, Execution, Deployment > Compiler > Kotlin Compiler
    • Change the Target JVM version to 1.8
    • Click Apply
  2. 参考答案2
  3. you should configure something like as follows in build.gradle

    tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
        kotlinOptions {
            jvmTarget = "1.8"
  4. 参考答案3
  5. As it is written in the using-maven docs from the Kotlin website:

    You just have to put <kotlin.compiler.jvmTarget>1.8</kotlin.compiler.jvmTarget> into the properties section of your pom.xml

  6. 参考答案4
  7. When the other solutions did not work for you (Changing JVM version on Compiler settings and adding jvmTarget into your build.gradle), because of your .iml files trying to force their configurations you can change the target platform from Project Settings.

    • Open Project Settings
    • Go to Facets
    • Click on your Kotlin module/modules
    • Change the Target Platform to JVM 1.8 (also it's better to check Use project settings option)
  8. 参考答案5
  9. You may also want to try invalidating the Intellij cache and restarting (File > Invalidate caches / restart). Having tried the steps above this seemed to do the trick for me, although I can't rule out that was just the restart that made the difference.