How to Specify Classes in Proguard Config to only obfuscate. Rest Keep without obfuscate. Maven JavaFx

How to Specify Classes in Proguard.Conf file to obfuscate. Rest classes should be packaged without obfuscation. I'm using Maven and JavaFx both in my applications. Tried so many options available in StackOverflow but was not resolved.


To specifically target what files you want to apply name obfuscation on, you can use specify a rule like the following in your Proguard.conf file:

-keep !com.classpath.to.classes.you.want.to.obfuscate

The above rule will make sure that all the classes except for the ones in this package will be kept. The ones inside the com.classpath.to.classes.you.want.to.obfuscate package will be obfuscated properly. The "!" character can be read as "everything but".

If you want to quickly see the effect of this keep rule on your application and thus, the level of obfuscation applied, you can use the ProGuard Playground: https://playground.proguard.com/. It is a handy tool, perfect for learning how ProGuard keep rules work.