IDEA: javac: source release 1.7 requires target release 1.7

后端 未结 18 1305
青春惊慌失措
青春惊慌失措 2020-11-22 06:26

When running a JUnit test, using IntelliJ IDEA, I get

\"enter

How can I correc

18条回答
  •  轮回少年
    2020-11-22 06:54

    If it is a Gradle project, in your build.gradle file, search for following settings:

    sourceCompatibility = "xx"
    targetCompatibility = "xx"
    

    For all subrpojects, in your root build.gradle file, you may put:

    subprojects { project ->
        sourceCompatibility = "1.7"
        targetCompatibility = "1.7"
    }
    

    Although you can manually set language levels in Idea > Settings, if it is a Gradle project, Idea automatically synchronizes module .iml files from Gradle settings ( tested with Idea 15+). So all your manual changes are overriden when gradle is refreshed.

    Based on Gradle documentation, if these are not set, then current JVM configuration is used.

提交回复
热议问题