IntelliJ: Error: java: release version 10 not supported

MiguelMunoz :

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

I don't understand this, since in Project Structure, I have these settings set: Project SDK: 9.0 Project Language Level: SDK Default Module Language Level: Project Default (both modules)

In my pom.xml files, I have these properties set in both modules:

<maven.compiler.source>9</maven.compiler.source>
<maven.compiler.target>9</maven.compiler.target>

I have no idea why it's trying to use JDK 10 for anything, but I still get that message. I'd be happy to use JDK10, but my project doesn't work in that version, so I'm going back to see which versions it works in. I have SDKs installed for version 1.4 through 10 I've also tried building using JDK 1.8, but I get a slightly different error message: Error: java: invalid target release: 10 I've found that I can build from the command line using JDK 9, but I need to build from my IDE. Can anyone tell me how to build my project using JDK 1.9 or 1.8? Thanks.

MiguelMunoz :

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>
        ...

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=34961&siteId=1