Xtend java source version configuration (maven) [message #1868121] |
Thu, 11 July 2024 15:26 |
|
Dear all,
I have Eclipse xtend plugins that have a lower Java compatibility level than the JRE/JDK used for compilation. In particular, I'd like to use OpenJDK21 for compilation, but the plugins are still at Java17.
The maven plugin configures the property javaSourceVersion to be lower which implies for instance that xtend extension need to be used for methods such as list.getLast().
However, if the xtend to Java generation is done with OpenJDK21, the javaSourceVersion configuration seems to be ignored, as for instance the method getLast is used in the generated Java code. Interestingly, setting JAVA_HOME to an older JRE implies that the maven org.eclipse.xtend modules produces the "right" code. But this is not a good solution for compilation on a CI server on which paths may change.
What is the method to configure the source code compatibility?
PS: Is it a bug that the javaSourceVersion attribute in class AbstractXtendCompilerMojo is defined by a property with a different name, see below?
@Parameter(property="maven.compiler.source", defaultValue="11")
private String javaSourceVersion;
|
|
|
|
Re: Xtend java source version configuration (maven) [message #1868130 is a reply to message #1868124] |
Thu, 11 July 2024 17:37 |
|
Thanks for the swift answer, but my problem is a different one (sorry, if that was not clear):
I want to generate Java code that is compatible with Java-17, not with Java-21. But the generation is done with an OpenJDK-21. And it currently seems that the JDK used for generation determines the code compatibility of the generated Java code and not the configuration.
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03519 seconds