-
Notifications
You must be signed in to change notification settings - Fork 163
Description
JEP 238: Multi-Release JAR Files describes the structure of Multirelease jars and when I add such a jar to my classpath it shows the corresponding selected classes so this looks fine.
Nerveless I have not found yet a way to produce such jar with JDT and maven indicates
Up until the moment of writing all IDEs can only have one JDK per Maven Project, whereas with multi release you want to specify it per source folder.
We recently have a similar request at m2e where it would be useful to specify different target release.
Because of this I'd like to propose preliminary support for JEP 238 in JDT in the following way:
- The project VM must be the highest of all release settings, but main code is compiled with lowest target version. e.g. I have a Java 21 JRE_CONTAINER, but enabled javaPlatform = 1.8 and want using a javaPlatform = 1.9 on multi-release.
on aAclasspathentryentry, allow beside a different output folder (what would be required in such a case), to specify the release like this<classpathentry kind="src" output="bin17" path="src17" release="17">classpathentryof kindsrccan contain a newattributewith the namereleaseand a value of >=9enables "multi-release-compilation"- this then automatically puts those compiled files into a folder
<output>/META-INF/versions/<release> - when compiling code for such a source folder, use the appropriate release setting for the given source files
The advantage of this would be, that there is no need to duplicate all settings (so I'm not aiming for different compiler settings for each folder) and map 1:1 for a setup you could use in maven with different executions defined for each release used and thus m2e could also leverage this later on.