groovy-eclipse icon indicating copy to clipboard operation
groovy-eclipse copied to clipboard

groovy-eclipse-compiler: Allow using "release" and "source/target" together

Open TobiX opened this issue 1 year ago • 2 comments

To simplify configuration for users still using Java 8 (yes, I know, I know), plexus-compiler 2.15.0 automatically filters the release parameter from the call to javac if it is < 9. This was merged into Maven compiler 3.13.0 (https://issues.apache.org/jira/browse/MCOMPILER-582) and Maven Javadoc 3.11.1 (https://issues.apache.org/jira/browse/MJAVADOC-787).

If I try to use the same simplified configuration with the groovy-eclipse-compiler, it complains instead:

16:09:38  [INFO] Recompiling the module because of changed dependency.
16:09:38  [INFO] Using Groovy-Eclipse compiler to compile both Java and Groovy files
16:09:38  [INFO] option --release is supported only when run with JDK 9 or above

It would be nice if it behaved the same as the other Maven plugins.

(See also the updated documentation: https://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-release.html#usage-on-jdk-8)

TobiX avatar Dec 04 '24 08:12 TobiX

Release support changes: #894 #896

Does the conditional configuration not work? If you can give release a blank value for JDK 8, groovy-eclipse-compiler will pass source and target.

The rub here is how to detect that tooling supports release or source/target. The tycho-compiler-plugin offers a special option for this: https://tycho.eclipseprojects.io/doc/2.7.5/tycho-compiler-plugin/compile-mojo.html#deriveReleaseCompilerArgumentFromTargetLevel

eric-milles avatar Dec 05 '24 20:12 eric-milles

Can you give this a try? I did what plexus-compiler did to determine the java version. I have not tested with all three config elements.

groovy-eclipse-compiler-3.9.1-SNAPSHOT.zip

eric-milles avatar Dec 05 '24 22:12 eric-milles