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
[MNG-6293] Support multi-release JARs (JDK 9 feature) #7585
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.
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.
Activity
jira-importer commentedon Oct 17, 2017
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.
jira-importer commentedon Oct 31, 2017
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.
jira-importer commentedon Oct 31, 2017
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
initializeuntilpre-packagefor 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.
jira-importer commentedon Jul 23, 2021
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.
gnodet commentedon Jul 7, 2025
Maven 4 and the new maven-compiler-plugin should make that much easier.