Adding module descriptor to existing JAR file
Gunnar Morling
gunnar at hibernate.org
Mon Feb 6 08:41:56 UTC 2017
Hi,
I'm trying to convert an existing non-modular JAR into a modular JAR.
Using jdeps, I was able to generate a module-info.java descriptor for
the module-to-be. And the help text of the "jar" command discusses how
to add a compiled module descriptor to an existing JAR:
jar --update --file foo.jar --main-class com.foo.Main --module-version 1.0
-C foo/ module-info.class
I'm struggling though with compiling the module descriptor. I tried
with --patch-module and also by providing the existing JAR via
--class-path (as it's not a module yet), but javac is complaining
about the exported packages from the module-info.java not being found:
module-info.java:7: error: package is empty or does not exist: com.foo
exports com.foo
Is there an example somewhere that shows how to use javac for
compiling a module descriptor, given the classes from a non-module
JAR? I'm looking for a way without re-compiling that entire JAR, as I
don't think that's practical or even possible in some cases.
Thanks for any pointers,
--Gunnar
More information about the jigsaw-dev
mailing list