Hello so i have upgraded from java 8 to java 11 and i get this error no matter what.I am using intellij and windows 10. What i have changed to 11: 1)In Project Structure -> Project:
2)Project Structure ->Modules
3)My compiler module Target bytecode version is set to 11 aswell in settings->Build,Execution,Deployment -> Java Compiler.
I even changed Both environment variables respectiveley the JAVA_HOME in user variables and JAVA_HOME in system variables to jdk-11.0.8.
When i run java -version and javac -version both show that i have version 11 installed. When i try running a mvn clean package it always fails with this error
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project abc: Fatal error compiling: invalid
target release: 11 -> [Help 1]
Please help me fix the error, Any help would be greatly appreciated !
L.EThis is part of the project pom
<plugin>
<inherited>true</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<optimize>true</optimize>
<encoding>UTF-8</encoding>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
<compilerArguments>
<parameters/>
</compilerArguments>
</configuration>
I have also added <release>11</release> <!--or <release>10</release>-->
to it but same issue remains.
IntelliJ IDEA 2021.1.3 (Community Edition)
If you are using Gradle build tool:
File | Settings | Build, Execution, Deployment | Build Tools | Gradle
Choose your project and choose Gradle JVM version 11.
Please check your JDK 11 Setup in IntelliJ! Even though the project SDK is called 11, it still says that your java-version is 1.8.161. Judging from this it looks like your new jdk 11 still points to your old 1.8 installation which does not now about version 11 yet.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With