Software⏱️ 2 min read📅 2026-05-31

How to Fix: Maven is not using Java 11: error message "Fatal error compiling: invalid target release: 11"

Maven Java version conflict error solution

Quick Answer: The issue is likely due to the Java version specified in your project's pom.xml file not matching the Java version installed on your system. Try updating the Java version in pom.xml to match the version installed on your system.

To resolve the error 'Maven is not using Java 11: fatal error compiling invalid target release: 11' when trying to compile a project with Java 11, you need to update your Maven project settings.

🚀 How to Resolve This Issue

Method 1: Update Maven Configuration

  1. Step 1: Open your pom.xml file in a text editor.

Method 2: Update Maven Profile

  1. Step 1: Add the following profile to your pom.xml file:
<profiles>
<profile>
<id>java11</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
</plugins>
</build>
</profile>
/profiles>

After updating your Maven configuration, try compiling your project again with Java 11.

✨ Wrapping Up

By following these steps, you should be able to resolve the error 'Maven is not using Java 11: fatal error compiling invalid target release: 11' when trying to compile a project with Java 11.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions