Home | History | Annotate | Download | only in examples
      1 #
      2 # This ProGuard configuration file illustrates how to process servlets.
      3 # Usage:
      4 #     java -jar proguard.jar @servlets.pro
      5 #
      6 
      7 # Specify the input jars, output jars, and library jars.
      8 
      9 -injars  in.jar
     10 -outjars out.jar
     11 
     12 -libraryjars <java.home>/lib/rt.jar
     13 -libraryjars /usr/local/java/servlet/servlet.jar
     14 
     15 # Save the obfuscation mapping to a file, so you can de-obfuscate any stack
     16 # traces later on. Keep a fixed source file attribute and all line number
     17 # tables to get line numbers in the stack traces.
     18 # You can comment this out if you're not interested in stack traces.
     19 
     20 -printmapping out.map
     21 -renamesourcefileattribute SourceFile
     22 -keepattributes SourceFile,LineNumberTable
     23 
     24 # Preserve all annotations.
     25 
     26 -keepattributes *Annotation*
     27 
     28 # You can print out the seeds that are matching the keep options below.
     29 
     30 #-printseeds out.seeds
     31 
     32 # Preserve all public servlets.
     33 
     34 -keep public class * implements javax.servlet.Servlet
     35 
     36 # Preserve all native method names and the names of their classes.
     37 
     38 -keepclasseswithmembernames class * {
     39     native <methods>;
     40 }
     41 
     42 # Preserve the special static methods that are required in all enumeration
     43 # classes.
     44 
     45 -keepclassmembers class * extends java.lang.Enum {
     46     public static **[] values();
     47     public static ** valueOf(java.lang.String);
     48 }
     49 
     50 # Explicitly preserve all serialization members. The Serializable interface
     51 # is only a marker interface, so it wouldn't save them.
     52 # You can comment this out if your library doesn't use serialization.
     53 # If your code contains serializable classes that have to be backward
     54 # compatible, please refer to the manual.
     55 
     56 -keepclassmembers class * implements java.io.Serializable {
     57     static final long serialVersionUID;
     58     static final java.io.ObjectStreamField[] serialPersistentFields;
     59     private void writeObject(java.io.ObjectOutputStream);
     60     private void readObject(java.io.ObjectInputStream);
     61     java.lang.Object writeReplace();
     62     java.lang.Object readResolve();
     63 }
     64 
     65 # Your application may contain more items that need to be preserved;
     66 # typically classes that are dynamically created using Class.forName:
     67 
     68 # -keep public class mypackage.MyClass
     69 # -keep public interface mypackage.MyInterface
     70 # -keep public class * implements mypackage.MyInterface
     71