Menu

#624 Proguard packaging breaks jar without changing any file inside jar

v5.2
closed-fixed
nobody
None
5
2016-10-23
2016-10-10
Arlind
No

Proguard seams to break a given jar although the files themself are not changed.
Checkout the following git example:
https://github.com/ArlindNocaj/jogl_gradle

Using gradle proguard generated two jar files where the proguard output does not start anymore using java -jar.
The used proguard config is:

-dontwarn
-dontobfuscate
-dontshrink
-dontoptimize
-dontpreverify

I checked the jar files using pkgDiff to see the differences inside the jars. There are no differences regarding the files inside the jar.
Anyone has a hint on how to fix this issue?

Discussion

  • Arlind

    Arlind - 2016-10-10

    Workaround:
    Workaround:
    Repackaging the proguard output jar actually makes the jar work again.

    unzip -d v proguard-jogl_gradle.jar
    jar cfm rebuild.jar v/META-INF/MANIFEST.MF -C v .
    java -jar rebuild.jar 
    

    Any hints how to fix this issue within proguard?

     
  • Arlind

    Arlind - 2016-10-11

    Finally I found out that the difference between the two jars is only the missing directory entries in the proguard output jar.

    Including the directories into that jar using the -keepdirectories option fixes this problem.

     
  • Eric Lafortune

    Eric Lafortune - 2016-10-23

    Good to hear you found the cause. This is indeed a subtle difference in packaging, to make the jars as small as possible. It only matters very rarely; the option -keepdirectories is the correct solution.

     
  • Eric Lafortune

    Eric Lafortune - 2016-10-23
    • status: open --> closed-fixed
     

Log in to post a comment.

MongoDB Logo MongoDB