2

I have to obfuscate lib and application. Lib - simple lib with two classes. Obfuscation done well. Application(with obfuscated lib in dependencies) builded with springboot plugin, works well. When I try to obfuscate application jar I have got jar without *.classes of my app.

here is proguard conf:

-verbose
-dontwarn
-dontoptimize
-dontpreverify
-printmapping out.map
-keepattributes Exceptions,InnerClasses,Signature,Deprecated,SourceFile,LineNumberTable,*Annotation*,EnclosingMethod
-keepdirectories

-keep class org.springframework.******* { *;}

-keep public class * extends RequestEntity { *;}
-keep public class * extends ResponseEntity { *;}
-keepclassmembers,allowoptimization enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}
-keepnames class * implements java.io.Serializable {*; }

-keepclasseswithmembers public class * {
    public static void main(java.lang.String[]);
}

classes:

public class TestEntity {
    private Integer fieldInt;

    private String fieldStr
--cut--- (set* get*)

public class TestActions {
    private TestEntity entity;
    Gson gson = new Gson();

--cut---(set* get*)

import my.act.TestActions;

public class App {
    public static void main(String[] args) {
        TestActions testActions=new TestActions();
        testActions.doPrintEntity();
    }
}

out.map:

my.App -> my.App:
    6:6:void <init>() -> <init>
    8:10:void main(java.lang.String[]) -> main
org.springframework.boot.loader.ExecutableArchiveLauncher -> org.springframework.boot.loader.ExecutableArchiveLauncher:
    org.springframework.boot.loader.archive.Archive archive -> archive
    37:44:void <init>() -> <init>


--cut---
rows about spring...

and I have got test_app1.jar without my.App, only empty folder: test_app1.jar\BOOT-INF\classes\my\

Any ideas? Help please...

Alexandr
  • 71
  • 4

1 Answers1

0

If you use proguard maven plugin for a springboot application. Don't forget to add spring package plugin as well.

Kami Wan
  • 724
  • 2
  • 9
  • 23