Maven: Invalid target release: 10

We Are Going To Discuss About Maven: Invalid target release: 10. So lets Start this Java Article.

Maven: Invalid target release: 10

  1. Maven: Invalid target release: 10

    Same problem fixed for me by setting JAVA_HOME environment variable to point to the JDK with right version.

  2. Maven: Invalid target release: 10

    Same problem fixed for me by setting JAVA_HOME environment variable to point to the JDK with right version.

Solution 1

Same problem fixed for me by setting JAVA_HOME environment variable to point to the JDK with right version.

My source and destination java version in maven-compiler-plugin were 11, java -version was also on version 11, but my JAVA_HOME was pointing to JDK-1.8.

Check JAVA_HOME again by using a terminal instead of IDE:

Linux:
echo $JAVA_HOME

Win:
echo %JAVA_HOME%

Then Build your project in the same terminal:

mvn clean package

Original Author msd.salehi Of This Content

Solution 2

This worked for me:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.7.0</version>
            <configuration>
                <release>10</release>
            </configuration>
        </plugin>
    </plugins>
</build>

This answer says you need:

<dependencies>
    <dependency>
        <groupId>org.ow2.asm</groupId>
        <artifactId>asm</artifactId>
        <version>6.2</version> <!-- Use newer version of ASM -->
    </dependency>
</dependencies>

inside the <plugin/> tag, but the newer mvn (3.5.4) must obviate that, since I didn’t need it.

Original Author David Conrad Of This Content

Solution 3

Get your java version by running java -version.

You’ll get a output like :

java version "1.8.0_201"

Now go to your POM file and update source and target properities of maven-compiler-plugin with your installed java version. In my case it’s 1.8

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

Original Author Lanil Marasinghe Of This Content

Solution 4

I had a similar problem with spring boot and java 11.
I solved it by defining the following property in my pom

<maven.compiler.release>11</maven.compiler.release>

Might be useful for someone in the future.

Original Author Varesh Of This Content

Conclusion

So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.

Also Read,

Siddharth

I am an Information Technology Engineer. I have Completed my MCA And I have 4 Year Plus Experience, I am a web developer with knowledge of multiple back-end platforms Like PHP, Node.js, Python and frontend JavaScript frameworks Like Angular, React, and Vue.

Leave a Comment