0

When I try to run as maven build it always give BUILD FAILURE.

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

I already tried the following things:

  • remove .m2 folder
  • reinstall eclipse
  • set executable on pom.xml
  • set build option to clean
> java -version
java version "1.8.0_261"

> echo %JAVA_HOME%
C:\Program Files\Java\jdk1.8.0_211

pom.xml

<plugin>
    <inherited>true</inherited>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.8.0</version>
    <configuration>
        <source>11</source>
        <target>11</target>
        <encoding>UTF-8</encoding>
        <showWarnings>true</showWarnings>
        <showDeprecation>true</showDeprecation>
    </configuration>
</plugin>

None of them worked. Any guesses?

ThRnk
  • 575
  • 2
  • 19
  • It might have to do with Java 11. Do you have java 11 installed ? take a look at this : https://stackoverflow.com/questions/63154787/maven-is-not-using-java-11-fatal-error-compiling-invalid-target-release-11 – AntiqTech Oct 24 '20 at 00:01
  • 1
    I updated my question with the results – ThRnk Oct 24 '20 at 00:06
  • I'm seeing a lot of suggestions regarding setting version in pom. Can you add your pom.xml content to question ? – AntiqTech Oct 24 '20 at 00:13
  • Also what does "mvn –version" produce on command line ? – AntiqTech Oct 24 '20 at 00:17
  • 1
    As I don't have `Apache Maven` it doesn't have that command. – ThRnk Oct 24 '20 at 00:25
  • @AntiqTech I added just the important part of the xml I think, SO doesn't allow much code. – ThRnk Oct 24 '20 at 00:29
  • 11 11 These are the parts I see gets updated in the examples. Try replacing 11 with 1.8 since you have 1.8 version installed. – AntiqTech Oct 24 '20 at 00:41

1 Answers1

0

I managed to find a solution.

I installed JDK 11 and set it at Window > Preferences > Java > Installed JREs > Add > jdk-11.0.9

Downloaded at: https://www.oracle.com/java/technologies/javase-jdk11-downloads.html

ThRnk
  • 575
  • 2
  • 19