Building jar targeting multiple Java versions, including 9

Alan Bateman Alan.Bateman at oracle.com
Fri Aug 26 10:22:43 UTC 2016



On 26/08/2016 10:16, Uwe Schindler wrote:
> - In addition we would have a separate compilation unit with only a single module-info.java and that’s compiled with Java 9's Javac. The resulting file could be placed in the JAR file, too (not sure where: In root or in the multi-release place??? The latter would allow us to merge this with the previous point and we would not need 3 compilation runs).
>
It should be in the root directory. We need to update JEP 238 or JEP 261 
to properly document the proposal for how modular JARs should work as 
multi-release JAR. It has been touched on in a couple of threads but 
isn't written down clearly. Briefly, the proposal is that 
module-info.class is allowed in META-INF/versions/<N>. When 
module-info.class is in the versioned section then it should be the same 
as the module-info.class in the root directory except that it might have 
different non-public `requires` on java.* or jdk.* modules. It might 
also have different `uses` clauses. The high level intention is that the 
module API doesn't change and the differences in the module declaration 
are just implementation details.

-Alan


More information about the jigsaw-dev mailing list