Reputation: 6824
I am getting a maven compiler error when compiling with JDK 1.8
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project DUMMY : Fatal error compiling: invalid flag: --release -> [Help 1]
Here is my pom configuration for compiler plugin
<configuration>
<source>${maven.compiler.release}</source>
<target>${maven.compiler.release}</target>
<release>${maven.compiler.release}</release>
<jdkToolchain>
<version>${maven.compiler.release}</version>
</jdkToolchain>
<verbose>false</verbose>
<useIncrementalCompilation>false</useIncrementalCompilation>
<executable>${env.JAVA_HOME}/bin/javac</executable>
</configuration>
Have I configured this incorrectly? Also, this works fine when I have Java 11 for JAVA_HOME
, but not with Java 8. Is this expected? Also, from the docs I see that maven.compiler.release
is tied with release
config anyway. So, does it mean I can ommit the release
attribute below and it should be fine?
Upvotes: 7
Views: 28059
Reputation: 611
Below are 2 fixes I applied to make it work.
Fix 1: Missed to point out to JDK11 Version in environment variables. So cross verify both User variables and System variables path
Fix 2: Even after fix 1 STS throwed same error again and again while doing mvn install. Restarted STS tool helped to reflect path. Issue got fixed
Upvotes: 0
Reputation: 1066
As mentioned in documentation this argument supported since Java 9, so either change your JDK version or just remove it.
Upvotes: 11