You want to confuse code when you package a category in an existing web project. Because Maven is used for management, Google found that similar plug-ins already exist. You only need to go back to the plug-in and add the corresponding configuration file. This article only makes relevant records
1. Modify Pom. XML to add a plug-in
<Plugin> <groupid> COM. pyx4me </groupid> <artifactid> proguard-Maven-plugin </artifactid> <executions> <execution> <phase> package </phase> <goals> <goal> proguard </ goal> </goals> </execution> </executions> <configuration> <obfuscate> true </obfuscate> <proguardinclude >$ {basedir}/proguard. conf </proguardinclude> <! -- Add dependency. Here you can modify as needed --> <libs> <lib >$ {Java. home}/lib/RT. jar </lib> <lib> lib/fcexporter_jdk1.5.jar </lib> <lib> lib/fcexporthandler. </lib> <lib> lib/jsp-api.jar </lib> <lib> lib/servlet-api.jar </lib> </libs> <addmavendescriptor> false </addmavendescriptor> </Configuration> <dependencies> <! -- Use version 4.8 for obfuscation --> <dependency> <groupid> net. SF. proguard </groupid> <artifactid> proguard </artifactid> <version> 4.8 </version> <scope> runtime </scope> </dependency> </dependencies> </plugin>
2. Add the proguard. conf file in the Pom. xml level directory.
# Dependencies # execution can be performed through a specified number of optimizations #-optimizationpasses N # optimized optimizationpasses 3 # classes are not generated in obfuscation #-dontusemixedcaseclassnames # specified dontusemixedcaseclassnames # ignore non-public library classes #-libraries # classes #-dontskipnonpubliclibraryclasses # classes # non-Pre-validation #-dontpreverify # classes #-dontpreverify # outputs generated information #-verbose # explain verbose # application intrusive overload during obfuscation-overloadaggressively # Allow access to and modify modifier-related classes and Class Members-allowaccessmodification # determine the name of a unified obfuscation class member to add obfuscation-useuniqueclassmembernames # Add the class you do not need to confuse here-keep class com. zsoftware. common. cache. ** {*;}-keep class COM. zsoftware. common. constant. ** {*;}-keep class COM. zsoftware. common. DWR. ** {*;}-keep class COM. zsoftware. common. servelt. ** {*;}-keep class COM. zsoftware. common. util. ** {*;}-keep class COM. zsoftware. component. ** {*;}-keep class COM. zsoftware. interfacepkg. ** {*;}-keep class COM. zsoftware. model. ** {*;}-keep class COM. zsoftware. view. ** {*;}-keep class COM. zsoftware. webresource. ** {*;}-keep public class * extends javax. servlet. servlet-keepdirectories **-keepattributes ** #-keepnames class * implements Java. io. serializable # --------- protect the field names in all entities ----------- keepclassmembers class * implements Java. io. serializable {<fields >;}# --------- all method names in the protection class ------------- keepclassmembers class * {Public <Methods> ;}
3. You can package the MVN package to find that the output result package has been mixed.