Fix: Maven - Failed to execute goal - Compilation failure - Source/Target option 5 is no longer supported. Use 7 or later


Maven - Failed to execute goal - Compilation failure - Source Target option 5 is no longer supported
[ERROR]COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] Source option 5 is no longer supported. Use 7 or later.
[ERROR] Target option 5 is no longer supported. Use 7 or later.

[INFO] BUILD FAILURE
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile

If you get the above error when you try to build a Java project using Maven, then make sure that you have the maven.compiler.source and maven.compiler.target set to java 8 or higher,

Fix:
<project xmlns="http://maven.apache.org/POM/4.0.0" 
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
 https://maven.apache.org/xsd/maven-4.0.0.xsd">
	
        <modelVersion>4.0.0</modelVersion>
	<groupId>myprog</groupId>
	<artifactId>myprog</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<dependencies>
		...
                ...
	</dependencies>
	<properties>
		<maven.compiler.source>1.8</maven.compiler.source>
		<maven.compiler.target>1.8</maven.compiler.target>
	</properties>
</project>
-




Have Questions? Post them here!