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 # Preserve all public servlets. 16 17 -keep public class * implements javax.servlet.Servlet 18 19 # Print out a list of what we're preserving. 20 21 -printseeds 22 23 # Preserve all annotations. 24 25 -keepattributes *Annotation* 26 27 # Preserve all native method names and the names of their classes. 28 29 -keepclasseswithmembernames class * { 30 native <methods>; 31 } 32 33 # Preserve the special static methods that are required in all enumeration 34 # classes. 35 36 -keepclassmembers class * extends java.lang.Enum { 37 public static **[] values(); 38 public static ** valueOf(java.lang.String); 39 } 40 41 # Explicitly preserve all serialization members. The Serializable interface 42 # is only a marker interface, so it wouldn't save them. 43 # You can comment this out if your library doesn't use serialization. 44 # If your code contains serializable classes that have to be backward 45 # compatible, please refer to the manual. 46 47 -keepclassmembers class * implements java.io.Serializable { 48 static final long serialVersionUID; 49 static final java.io.ObjectStreamField[] serialPersistentFields; 50 private void writeObject(java.io.ObjectOutputStream); 51 private void readObject(java.io.ObjectInputStream); 52 java.lang.Object writeReplace(); 53 java.lang.Object readResolve(); 54 } 55 56 # Your application may contain more items that need to be preserved; 57 # typically classes that are dynamically created using Class.forName: 58 59 # -keep public class mypackage.MyClass 60 # -keep public interface mypackage.MyInterface 61 # -keep public class * implements mypackage.MyInterface 62