Is it possible to obfuscate a module together with a specific external library?

I have a module that makes use of a custom library, i.e. made by me, and I would like to obfuscate both the module and the library itself.
As a project build tool I use maven and I also use proguard integrated with wvengen/proguard-maven-plugin. I have managed to generate a map with the obfuscated classes of both the module and the library, the problem is that in the .jar module of the library, if I extract it and go to the BOOT-INF library folder, the library is not obfuscated, so I don’t really understand what is happening.
Is it possible to integrate the obfuscated library into the module jar?

Greetings and thanks,
Ramiro

Hi @rjlg99 ,

When talking about the library not being obfuscated, are you referring to the name of the jar file or rather the names of classes in the jar file? ProGuard does not rename the file names in themselves.

Can you please share some snippets of the integration, the configuration and perhaps a screenshot of the part that’s not obfuscated?

Best regards,

Jonas

Hi @jonas.gijbels,
I am not referring to the name of the jar itself, but to the classes that are inside the jar, I am passing you screenshots to make it clearer for you:

In this picture I show you how I configure proguard through maven. The library I add as a normal maven dependency.

The result is my obfuscated module itself, with its respective proguard_map.txt in which both the internal references of the module and the references to the library are obfuscated, however, if I unzip the jar, and go to the "BOOT-INF\libs" folder and decompile library.jar, I realise that it is not really obfuscated, so my main module never starts, because on one side it calls the library as if it was obfuscated but it really is not.

My question is if proguard really allows to obfuscate the external library and inject inside the .jar.

Thanks for your help,
Ramiro

Hi @rjlg99 ,

Since you’ve mentioned BOOT-INF, it sounds like you’re using Spring Boot. Spring Boot is a bit complicated to use with ProGuard - you have to manually extract classes from the BOOT-INF inside the jar, obfuscate them, and then rebuild the jar.

Please see the Gradle tasks here

Here’s another example of using Spring Boot with Proguard (but it uses Gradle instead of Maven)

Hope this helps!

1 Like