zyxist / chainsaw

Gradle plugin: adds support for building Java 9 modules.
Apache License 2.0
70 stars 4 forks source link

Support for multi-release JARs to build proper modules for Java 9 that still work for Java 8 or older #24

Closed Vampire closed 6 years ago

Vampire commented 6 years ago

If #23 got implements, it would be nice if you could apply the chainsaw plugin to Java 8 or older projects. If it recognizes that it is applied to a Java 8 or older project (sourceCompatibility property) it could pimp the generated JAR by generating and compiling the generated module-info.java in a separate source set, e. g. moduleInfo which compileModuleInfoJava task is configure with sourceCompatibility = 9. The jar task can then be configured to put the compiled module-info.class into META-INF/versions/9/ and the manifest attribute Multi-Release: true to be set, then the JAR can be used with Java 8 or older and is a proper named module with Java 9 or newer.

zyxist commented 6 years ago

Support for multi-release JAR-s is already planned as issue #3 - if you see something useful that can be added to the topic, just post it there. I'm closing this issue as a duplicate.