close

[Solved] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project demo: Fatal error compiling: invalid target release: 11

Hello Guys, How are you all? Hope You all Are Fine. Today When I am trying to run my project with java 11 I am facing following error Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project demo: Fatal error compiling: invalid target release: 11 in java. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How This Error Occurs ?

When I am trying to run my project with java 11 I am facing following error.

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project demo: Fatal error compiling: invalid target release: 11 -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] [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/MojoExecutionException

How To Solve Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project demo: Fatal error compiling: invalid target release: 11 Error ?

  1. How To Solve Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project demo: Fatal error compiling: invalid target release: 11 Error ?

    To Solve Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project demo: Fatal error compiling: invalid target release: 11 Error before calling maven, try using set JAVA_HOME=C:\path\to\jdk11 on the first line and your error must be solved. Second solution is Just check the JRE in use for Maven. First of all Run Configurations. Then, Select your Maven Build configuration. Now, Click the JRE tab and choose the JRE version in accordance with your POM.

  2. Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project demo: Fatal error compiling: invalid target release: 11

    To Solve Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project demo: Fatal error compiling: invalid target release: 11 Error before calling maven, try using set JAVA_HOME=C:\path\to\jdk11 on the first line and your error must be solved. Second solution is Just check the JRE in use for Maven. First of all Run Configurations. Then, Select your Maven Build configuration. Now, Click the JRE tab and choose the JRE version in accordance with your POM.

Solution 1: add this line in pom.xml

You need to add your own context in pom.xml.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <configuration>
        <source>1.8</source>
        <target>1.8</target>
    </configuration>
</plugin>

Solution 2: set JAVA_HOME

before calling maven, try using set JAVA_HOME=C:\path\to\jdk11 on the first line and your error must be solved.

Solution 3: add java version in pom.xml

add java version in pom.xml. add this follow code in your pom file.

<properties>
    <java.version>1.8</java.version>
</properties>

Solution 4: Check JRE version

Just check the JRE in use for Maven.

First of all Run Configurations.
Then, Select your Maven Build configuration.
Now, Click the JRE tab and choose the JRE version in accordance with your POM.

Summary

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also, Read

Leave a Comment