IntelliJ: Error: java: release version 10 not supported

后端 未结 13 1944
甜味超标
甜味超标 2020-12-24 01:45

In IntelliJ, I\'m getting this strange error message when I try to build from the build menu

Error: java: release version 10 not supported

相关标签:
13条回答
  • 2020-12-24 02:00

    For someone just update their maven file in properties section, please make sure if you click the refresh on the IDE maven tool in order to trigger the prop settings.

    Step 1.

    <properties>
        <maven.compiler.source>1.5</maven.compiler.source>
        <maven.compiler.target>1.5</maven.compiler.target>
    </properties>
    

    Step 2. (very important!!!)

    Click "refresh" icon on IntelliJ Maven tool bar.

    0 讨论(0)
  • 2020-12-24 02:06

    Probably your IntelliJ IDEA previously used Java 8. Starting from java 9 Java, instead of having 2 parts, jdk and jre, Java has only one, the jdk. I have got the same error message when I switched from java 8 to java 11. So you have to switch the IntelliJ IDEA to the new Java version.

    Open the Project Structure(Ctrl+Shift+Alt+S)

    Alternatively, from the IntelliJ IDEA menu: File -> Project Structure -> Project

    Define the new jdk. Recompile the project.

    This has worked for me.

    0 讨论(0)
  • 2020-12-24 02:06

    putting below code in pom.xml works.

    <maven.compiler.release>11</maven.compiler.release>

    0 讨论(0)
  • 2020-12-24 02:12

    For me in IntelliJ, I just went to file then project structure then I chose different SDK version rather the one shown in the error message and the error has gone :)

    0 讨论(0)
  • 2020-12-24 02:13

    I solved this by going to Maven settings;

    Step 1. either going through;

    • monkey wrench icon in maven (jump to step 2)
    • File - Settings or Ctrl+Alt+S

    Step 2. Go to Build, Execution, Deployment - Maven - Importing: JDK for importer (at the bottom)

    0 讨论(0)
  • 2020-12-24 02:14

    I just figured it out. I also needed to adjust the version in the maven-compiler-plugin. I'm using version 3.8.0. I needed to change this value:

    <release>10</release>
    

    Here's where I found it:

    <build>
      <plugins>
        <plugin>
          <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.0</version>
            <configuration>
                <release>10</release> <!-- This was the problem. -->
            </configuration>
            ...
    
    0 讨论(0)
提交回复
热议问题