You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
"release" parameter should only be set for javac version >= 9 #140
Sometimes it is difficult to set up the plugin configuration in a way to support different JDKs (maybe even using toolchains). For example look at MPOM-264. To ease that the JavacCompiler should only use the -release parameter with version 9 or above as using it with earlier versions leads to errors.
This should be done at maven-compiler-plugin level, to ensure that every compiler implementation gets the same set of arguments. The more I think about it, the more it looks like https://issues.apache.org/jira/browse/MCOMPILER-270 from almost 5 years ago.
Reading the conclusion I still agree with myself: using the release flag should be a choice of the project, it should not be calculated as there are situation where you don't want to use the release flag. As long as the compiler supports source/target it must be possible to pass it as is.
IMHO plexus-compiler and m-compiler-p is a higher level abstraction and therefore should try to translate the intent of the parameter into the compiler specific flags. Release is clearly a parameter for javac >= 9 but does mot make sense for earlier versions nor for some other compilers.
Activity
rfscholte commentedon Jun 17, 2021
This should be done at maven-compiler-plugin level, to ensure that every compiler implementation gets the same set of arguments. The more I think about it, the more it looks like https://issues.apache.org/jira/browse/MCOMPILER-270 from almost 5 years ago.
Reading the conclusion I still agree with myself: using the release flag should be a choice of the project, it should not be calculated as there are situation where you don't want to use the release flag. As long as the compiler supports source/target it must be possible to pass it as is.
kwin commentedon Jun 17, 2021
IMHO plexus-compiler and m-compiler-p is a higher level abstraction and therefore should try to translate the intent of the parameter into the compiler specific flags. Release is clearly a parameter for javac >= 9 but does mot make sense for earlier versions nor for some other compilers.
slachiewicz commentedon May 6, 2022
a lot of code in JavacCompiler related to Java < 8 can be deleted
rfscholte commentedon May 6, 2022
I don't think so. Keep in mind that you can still use toolchain, and best practice is to use the targeted JDK to compile.
kwin commentedon Feb 1, 2024
There is already
plexus-compiler/plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac/JavacCompiler.java
Line 370 in 0a0aab0
-source(only supported in javac 1.4 or newer) orplexus-compiler/plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac/JavacCompiler.java
Line 321 in 0a0aab0
-parameters.Only use "-release" parameter with javac 9+
Only use "-release" parameter with javac 9+ (#362)