Maven BUILD FAILURE: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin


[INFO] Scanning for projects...
[INFO] Building csvexample 0.0.1-SNAPSHOT
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ csvexample ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\code2care\eclipse-workspace\csvexample\src\main\resources
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ csvexample ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to C:\Users\code2care\eclipse-workspace\csvexample\target\classes
[ERROR] COMPILATION ERROR : 
[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.
[INFO] 2 errors 
[INFO] BUILD FAILURE
[INFO] Total time:  1.035 s
[INFO] Finished at: 2020-11-06T21:56:34+05:30
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5:compile
 (default-compile) on project csvexample: 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]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

You can extract some important info from the above logs, "Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5, Source option 5 is no longer supported. Use 6 or later. Target option 1.5 is no longer supported. Use 1.6 or later." : Your build failed because either you missed to add maven plugin maven-compiler-plugin in your pom or added source or target below 1.5

How to fix this issue?

Add the following code in your pom.xml below </dependencies>.

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.5.0</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
    </plugins>
</build>
Maven BUILD FAILURE - Failed to execute goal org.apache.maven.plugins - maven-compiler-plugin
Maven BUILD FAILURE - Failed to execute goal org.apache.maven.plugins - maven-compiler-plugin