Maven error – invalid target release: 1.11
Maven compiles and hits the following fatal error messages:
Terminal
mvn compile
Fatal error compiling: error: invalid target release: 1.11
pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.11</source>
<target>1.11</target>
</configuration>
</plugin>
Solution
For maven-compiler-plugin
, the correct JDK version is 1.8, 1.9, 1.10, 10, 11, 12 ... 17 ...
pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
or
pom.xml
<properties>
<java.version>11</java.version>
</properties>
Note
Also, ensuring the JAVA_HOME
environment variable is pointing to the correct Java 11. Read this similar error invalid target release: 17
Hey,
I encountered the same issue while upgrading from 1.8 to 11. Please note, that you have to make sure that both JAVA_HOME and Path are updated with JDK 11 under Environment variable.
Thanks, article is updated with
JAVA_HOME
.Thanks for the tutorial. The compile only accept 14 not 14.0.2 or 15 not 15.0.1, that’s really a tiny bug but hard to find out
I experience the same issue on 15.0.1 as you notice. Have you found any resolution to this “tiny bug”?
Thanks, buddy!
you da real mvp
Thanks for the tutorial
Thank you, the JAVA_HOME was the pb for me
Thank you so much!
thanks!
Thank you, sir. I was stuck until I read this post.
Thank you soo much! I’ve been having issues all day setting up my new project and this helped greatly! ^ _ ^
It worked. Thanks!
Thank you Dude!
Thanks very much!
YOU ARE THE GUY!
My mvp too!
thank you!!!!
Thank you!
@Mykong
Thanks bro