Skip to content

[JEP 238] Multirelease support #265

@laeubi

Description

@laeubi

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:

  1. 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.
  2. on a classpathentry entry, 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"> A classpathentry of kind src can contain a new attribute with the name release and a value of >= 9 enables "multi-release-compilation"
  3. this then automatically puts those compiled files into a folder <output>/META-INF/versions/<release>
  4. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions