I'm upgrading a Java desktop application to JDK10 and need to leverage modules to use the javapackager
to build a native package.
Everything was working great until I added an obfuscation step using Proguard (6.0.2).
Once I enabled obfuscation (using a working proguard configuration file from the < JDK9 project) it works as expected but Proguard removes the module-info.class
from the output JAR which prevents javapackager
from finding the module.
According to Proguard's documentation for the injars
parameter
By default, any non-class files will be copied without changes.
The problem here is that module-info.class
is a "class" file (albeit a weird one). The "keep" rules depend on class names so I don't think there is any rule I can use to prevent this removal.
How can I get Proguard to keep the module-info.class
file?
module-info.class
ends in.class
it's not a class file. And according to the manual the-keep
options need to be followed by the class specification guardsquare.com/en/proguard/manual/usage#classspecification. The problem is that the file doesn't hold a class/interface/enum, just the description of the module. From what I've read, the version I used (6.0.2) should already support JDK9, so it would be natural for it to ignore the file but it's not. – Kinky