release version 1.8 not supported

radlan :

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?

Naman :

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>

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=36954&siteId=1