[Solved]: Maven Error “Source option 5 is no longer supported. Use 6 or later”

While build my maven java project getting below exception.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project Sym360: Compilation failure: Compilation failure: 
[ERROR] Source option 5 is no longer supported. Use 6 or later.
[ERROR] Target option 1.5 is no longer supported. Use 1.6 or later.
[ERROR] -> [Help 1]


This issue is because the maven is not able to identify which version of java compiler need to use while build your code.


There are two solution to handle such problem.

  1. If you are using simple maven java application then you can add these lines in you pom.xml properties tag .
  1. If you application is spring boot application and defining maven compiler then add these lines in your pom.xml build tag.

Based on your code written and compatibility of java version, you can update this java version like java 11 etc.

I have solved this problem by using these two solution. If you know any other way to solve it write in comments to help others.