Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to obfuscate a library jar in ProGuard?

I have a jar that uses another jar as a library. I want them both to be obfuscated.
Quoting ProGuard documentation:

ProGuard requires the library jars (or wars, ears, zips, or directories) of the input jars to be specified. These are essentially the libraries that you would need for compiling the code. ProGuard uses them to reconstruct the class dependencies that are necessary for proper processing. The library jars themselves always remain unchanged. You should still put them in the class path of your final application.

How can I change this behavior?

UPDATE:
I cannot use incremental obfuscation because I wouldn't know what to specify as entry points for the library jar.

like image 400
atoMerz Avatar asked Feb 16 '23 21:02

atoMerz


1 Answers

You just need to specify your two jars as input jars (with the option -injars). They will then both be obfuscated. Any other jars, such as the run-time jar, are library jars (specified with the option -libraryjars). ProGuard needs them to properly process your code, but it leaves them unchanged.

like image 143
Eric Lafortune Avatar answered Feb 26 '23 19:02

Eric Lafortune