Run Proguard on a Spring project

I tried downloading ProGuard and running the examples folder. I do not want to run the android sample project. I want to use ProGuard just to remove dead code from my Spring Application. But I do not understand what needs to be mentioned in the build.gradle file instead of the android block and what other files should be a part of my Spring application and is the ANDROID_SDK needed even if it is a spring application. Are there any resources which can help get started with ProGuard to remove dead code from Spring application ? If not, can some HelloWorld application or some readme with all required details be provided to run ProGuard on a spring project preferably using maven ?

1 Like

For Java projects that are not Android related, you can integrate ProGuard e.g. as a gradle task. This is explained in more detail here: https://www.guardsquare.com/en/products/proguard/manual/gradle.

If you only want ProGuard to shrink and optimize your Spring application (thus not obfuscate it), you might be interested in setting -dontobfuscate in your ProGuard configuration file.

1 Like