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

References

20 comments on “Maven error – invalid target release: 1.11

  1. Thank you, the JAVA_HOME was the pb for me

    Reply
  2. Thank you, sir. I was stuck until I read this post.

    Reply
  3. Thank you soo much! I’ve been having issues all day setting up my new project and this helped greatly! ^ _ ^

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

    Reply
    1. I experience the same issue on 15.0.1 as you notice. Have you found any resolution to this “tiny bug”?

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

    Reply

Leave a Comment

Your email address will not be published. Required fields are marked *