Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

release version 1.8 not supported

I have a project that is using Java 8.

Up to now in the pom we specified the source and target version as 1.8:

<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>

We want to utilize the "-release" Option of Java 9+ and added the following:

<maven.compiler.release>1.8</maven.compiler.release>

But now we get the following error:

Fatal error compiling: release version 1.8 not supported

We are using maven 3.5.3, the maven-compiler-plugin in version 3.8.0 and Java 10 to compile the project.

What is wrong here?

like image 552
radlan Avatar asked Sep 20 '18 06:09

radlan


1 Answers

This should work

<maven.compiler.release>8</maven.compiler.release>

since the <release> attribute works with the major versions of releases only.

By, the way this is assuming that this is a parameter used in the actual compiler-plugin configuration somewhat like :

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.8.0</version>
    <configuration>
        <release>${maven.compiler.release}</release>
    </configuration>
</plugin>
like image 54
Naman Avatar answered Nov 10 '22 08:11

Naman