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

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>

References

About the Author

author image
mkyong
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter. If you like my tutorials, consider make a donation to these charities.

Comments

avatar