Intellij maven project Fatal error compiling: invalid flag: –release

We Are Going To Discuss About Intellij maven project Fatal error compiling: invalid flag: –release. So lets Start this Java Article.

Intellij maven project Fatal error compiling: invalid flag: –release

Advertisements
  1. Intellij maven project Fatal error compiling: invalid flag: –release

    In your pom.xml file, simply remove the tag <release>8</release> from your maven-compiler-plugin configuration:
    <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.7.0</version>

  2. Intellij maven project Fatal error compiling: invalid flag: –release

    In your pom.xml file, simply remove the tag <release>8</release> from your maven-compiler-plugin configuration:
    <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.7.0</version>

Solution 1

Advertisements

In your pom.xml file, simply remove the tag <release>8</release> from your maven-compiler-plugin configuration:

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

Original Author Matteo Baldi Of This Content

Solution 2

Advertisements

This has to do with the version of JDK running on your system. As per the documentation for maven-compiler-plugin, the release flag is supported since 1.9, and thus has to be commented/removed from the POM if you are using prior (1.8 and below) versions of JDK.

Check Maven documentation for release tag for maven-compiler-plugin here

Original Author Krishna Vedula Of This Content

Solution 3

Advertisements

open terminal to check that Maven using correct version of Java

run: mvn -v

If you will see an old Java version, that might be the problem.

Being on Linux, I suggest removing Maven, e.g. using Fedora package manager dnf remove maven or check your PATH for maven.

Download one from here: https://maven.apache.org/download.cgi

Extract downloaded to your home path, e.g. ~/maven.

Add/Edit ~/maven/bin to your PATH

Reapply .bash_profile (or re-login)

Run mvn -v

Now you should see a correct Java version in the output

Original Author izy Of This Content

Solution 4

Advertisements

I faced this problem too, check your JAVA_HOME environment variable.
I was setting the value of release to 11 as I am using JAVA 11.
My System JAVA_HOME was set for java 8, After adding the JAVA_HOME user environment variable to the java 11 path this got resolved.

Original Author Raulster24 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