Project Jigsaw: Modular JAR files
To ease migration to modules then it should be possible to include a module-info class in a JAR file's top-level directory. For now we call these JAR files "modular JAR" files. Existing tools could be updated to support them as follows:
- Extend
jmod
so that it can install a module presented as a JAR file with a module-info in the top-level directory. - Extend the
jar
command to make it easy to add a module-info to a JAR file. For simple cases then the module-info can be generated automatically given a module name and version. For example the Main-Class attribute in the manifest can be used as the module main class. It may also be possible to use the Class-Path attribute to construct the set of required modules (as least for the case that the referenced JAR files are modular JAR files themselves. Signed JAR files would clearly be a challenge as they would fail verification if a module-info is added after signing so the module-info would need to be added before signing.