2

I'm trying to use ProGuard to obfuscate my JAR file.

Specifically ... I have a Java/Spring web app. So I produce a WAR file.

I've copied all of my classes from the WAR file's /WEB-INF/classes folder into a new JAR file.

I launched ProGuard GUI and selected my JAR file as input. I specified a new output.JAR file. And I added all of the /WEB-INF/lib/*.jar files as "library jars".

I accept all defaults in ProGuard GUI and when I click "Process!" on the last page, it goes through the processing ... there is a list of "duplicate definition of library class" notes (which I'm pretty sure I can ignore?).

Then the output JAR is produced. But the output JAR only has three classes file in it ... the files that are in it are simple little test classes that I wrote to do simple code tests, and don't touch the rest of the app in any way.

None of my web app's class files are in the output JAR file.

What am I missing?

AndySummers2020
  • 411
  • 1
  • 6
  • 14

1 Answers1

2

ProGuard expects input classes to have file names that correspond to their fully-qualified class names, without any prefixes like "WEB-INF/classes". You probably see lots of warnings about it in the log. You can solve it by putting the classes in a jar in "WEB-INF/lib".

See the ProGuard manual > Troubleshooting > Warning: class file ... unexpectedly contains class ...

Eric Lafortune
  • 45,150
  • 8
  • 114
  • 106