Add support for building Multi-Release JARs
Description of the problem / feature request:
Add support for building JEP 238-compliant jars for distribution.
Feature requests: what underlying problem are you trying to solve with this feature?
- http://openjdk.java.net/jeps/238#Motivation.
- https://github.com/protocolbuffers/protobuf/issues/3781 is one concrete example of a desire for JEP 238 support in Bazel.
Alternatively, consider variant-aware dependency management similarly to what Gradle are considering.
This is really useful for projects that want to use the Java Platform Module System but remain backward compatible (such as Selenium).
The module-info needs to be compiled to target Java 9. Some apps freak out when they find a java class with an "incorrect" java version in a jar, meaning that it's not safe to mix-and-match class files targeting both Java 8 and 9+ in the same JAR, unless we use the multi-release capability.
On a related note, is there a plan to support consuming multi release JARs using the jvm_maven_import_external rule? I can open a separate issue for this if needed.
A cheap win would be to place code targeting JRE's later than 8 in multi-release jar compatible locations. That would basically provide all the support that most projects would need when creating JARs (though it will make shadowing trickier)