'ProGuard - unexpectedly contains class

While I'm trying to obfuscate simple DataLoader.class file in ProGuard I get this error:

Reading program directory [C:\Users\uzytkownik\Documents\NetBeansProjects\ProTest\build\classes\Files\DataLoader.class]
Warning: class [DataLoader.class] unexpectedly contains class [Files.DataLoader]
Warning: there were 1 classes in incorrectly named files.
         You should make sure all file names correspond to their class names.
         The directory hierarchies must correspond to the package hierarchies.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#unexpectedclass)
         If you don't mind the mentioned classes not being written out,
         you could try your luck using the '-ignorewarnings' option.
Please correct the above warnings first.

Here is the project: http://www49.zippyshare.com/v/14668241/file.html

I will be grateful for your help.



Solution 1:[1]

With the options -injars and -libraryjars, you should specify the proper base directory (or jar) of your classes, just like a classpath. In this case: classes, not classes\Files\DataLoader.class.

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

Solution 2:[2]

Warning: class [META-INF/versions/9/module-info.class] unexpectedly contains class [module-info] 

This is the issue I had and I tried few options mentioned below:

  1. -keep class module-info
  2. -keepattributes Module*
  3. -dontwarn module-info

The option worked for me is 3.

Not sure why but it solves my problem and I am able to make the jar.

This issue comes when you upgrade something like I upgrade the spring-boot version and the project starts failing.

Please check the maven dependencies as well.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Lonzak
Solution 2 Atul