12

I am having troubles with this which have been answered dusin of times on this site.

My take on the problem is a bit different. I have a project which builds fine using maven 3.5.x and java release 10 (configured in the maven-compiler-plugin) When looking in IntelliJ's project structure, all modules have language level 10 (but the projects settings is language level 6 and the chosen sdk in the project structure is 1.8...

However, even if I change the sdk to java 10 and the projects language level to 10, the error pasted below still occurs... ????

My IntelliJ version: IntelliJ IDEA 2018.2.5

To reproduce this error:

Information:java: Errors occurred while compiling module 'jactor-commons' Information:javac 10.0.1 was used to compile java sources Information:29/10/2018, 21:31 - Compilation completed with 1 error and 0 warnings in 4 s 777 ms Error:java: release version 5 not supported

Community
  • 1
  • 1
jactor-rises
  • 2,395
  • 2
  • 22
  • 44

3 Answers3

12

You can update the Java Compiler version of your module to be executed to use Java version 10 with the following settings :

Build, Execution, Deployment => Compiler => Java Compiler => Update Target Bytecode version

enter image description here

In the image above you can notice that the modules guice and hbase are defaulting to use Java version 5 while I've updated the others to use Java version 11 which is when compiling and executing them with JDK 11 works just fine.

Naman
  • 27,789
  • 26
  • 218
  • 353
3

In my case, I had to update value in pom.xml & refreshing maven.

<properties>
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>11</maven.compiler.target>
</properties>
R Sun
  • 1,353
  • 14
  • 17
2

I just update the pom.xml and it works for me.

<plugin>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.8.0</version>
    <configuration>
        <source>1.11</source>
        <target>1.11</target>
        <release>11</release>
    </configuration>
</plugin>
avenchoi
  • 21
  • 1