Skip to content

[MNG-6293] Support multi-release JARs (JDK 9 feature) #7585

Open

Description

@jira-importer

Marcus Hirt opened MNG-6293 and commented

In JDK 9 the concept of multi-release jars were introduced:
http://openjdk.java.net/jeps/238

It would be wonderful if maven supported building multi-release jars out-of-the-box. With the future high release-cadence of Java, this may become an increasingly important feature.

Here is an interim solution:
https://github.com/metlos/multi-release-jar-maven-plugin


0 votes, 8 watchers

Activity

  1. jira-importer commented on Oct 17, 2017

    @jira-importer
    Author

    Michael Osipov commented

    This is going to be very funny because Oracle hasn't wasted even a single thought how build tool makers can easily integrate this.

  2. jira-importer commented on Oct 31, 2017

    @jira-importer
    Author

    Marcus Hirt commented

    The JEP for this (https://bugs.openjdk.java.net/browse/JDK-8047305) seems to have been created in summer 2014. It has been part of pre-release builds since (at least) 2016. A quick search finds articles on this from 2016, and probably earlier. There has been plenty of time to provide feedback.

  3. jira-importer commented on Oct 31, 2017

    @jira-importer
    Author

    Robert Scholte commented

    We've defined a pattern a long time ago: https://github.com/hboutemy/maven-jep238
    It has the advantage that it already works with all current IDEs and that it has isolation of unittests per version.
    If you mean by out-of-the-box that is should be a single Maven Project, that will be quite hard to do. It requires multiple executions of all the phases between initialize until pre-package for every version, and package should bring them all together. The architecture of Maven is not capable to do that.
    Also think of how developers should maintain different implementations of the same class.
    All together I don't think that MRJARs will be very popular, it comes with too much pain. Having a solution is good enough for now.
    As said, if we want to handle MRJARs properly we need to change the whole architecture of Maven and right now I don't think taht's worth it. The pattern is sufficient enough.

  4. jira-importer commented on Jul 23, 2021

    @jira-importer
    Author

    Robert Scholte commented

    Currently we support close to "out-of-the-box". The problem is testing: there are several different ways to test, but it has impact on how to build a MRJAR. All can be read at https://maven.apache.org/plugins/maven-compiler-plugin/multirelease.html
    Currently we define 5 (!) patterns and all are available at https://github.com/apache/maven-compiler-plugin/tree/master/src/it/multirelease-patterns.

    I'm going to push this forward to Maven 5 just as a consideration, we still need to figure out how and if it is worth it.

  5. added
    enhancement
    priority:major
    on Jul 6, 2025
  6. gnodet commented on Jul 7, 2025

    @gnodet
    Contributor

    Maven 4 and the new maven-compiler-plugin should make that much easier.

  7. modified the milestones: 5.x, 4.x on Jul 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementpriority:major

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions