Maven invalid target release: 13

3.3k views Asked by At

I'm using Maven in Eclipse and i want to run my project with Java13. Every time i build my project i get the following error message:

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

I've configured my pom.xml file inside <properties> as follows:

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>13</maven.compiler.source>
<maven.compiler.target>13</maven.compiler.target>

and Java13 as JRE from Eclipse from Eclipse "Java Build Path" section.

enter image description here

Is there any settings that I have not considered?

2

There are 2 answers

0
beirtipol On BEST ANSWER

As naman suggested, you'll need to explicitly configure your maven compiler plugin:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
            <configuration>
                <source>13</source>
                <target>13</target>
            </configuration>
        </plugin>
...
0
Prashanth Sams On

In addition to the above post, you can also directly mention the release in configuration.

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