IDEA: javac: source release 1.7 requires target release 1.7

后端 未结 18 1082
青春惊慌失措
青春惊慌失措 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:59

    check .idea/misc.xml sometimes you need to change languageLevel="JDK_1_X" attribute manually

    0 讨论(0)
  • 2020-11-22 07:01

    I ran into this and the fix was to go to Project Settings > Modules > click on the particular module > Dependencies tab. I noticed the Module SDK was still set on 1.6, I changed it to 1.7 and it worked.

    0 讨论(0)
  • 2020-11-22 07:02

    If Maven build works fine, try to synchronizing structure of Maven and IntelliJ IDEA projects.

    In the Maven tool window, click refresh button . On pressing this button, IntelliJ IDEA parses the project structure in the Maven tool window.

    Note that this might not help if you're using EAP build, since Maven synchronization feature may be broken sometimes.

    0 讨论(0)
  • 2020-11-22 07:03

    If all the previous solutions haven't worked for you (which was my case), you can delete intellij config files:

    • project_directory/.idea/compiler.xml
    • project_directory/.idea/encodings.xml
    • project_directory/.idea/misc.xml
    • project_directory/.idea/modules.xml
    • project_directory/.idea/vcs.xml
    • project_directory/.idea/workspace.xml
    • etc.

    Intellij will regenerate new ones later. However, BE CAREFUL, this will also delete all intellij configuration made on the projet (i.e: configuration of debug mode, ...)

    0 讨论(0)
  • 2020-11-22 07:05

    I've hit this after just minor upgrade from IntelliJ IDEA 14 to v14.1. For me changing an edit of top/parent pom helped and then clicked re-import Maven (if it is not automatic).

    But it maybe just enough to Right Click on module(s)/aggregated/parent module and Maven -> Reimport.

    0 讨论(0)
  • 2020-11-22 07:05

    You need to change Java compiler version in in build config.

    0 讨论(0)
提交回复
热议问题