maven打包 实现代码混淆(先转载收藏,空了再看)

  • Post author:
  • Post category:其他


<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>

<libs>

<lib>${java.home}/lib/rt.jar</lib>

<lib>${java.home}/lib/jsse.jar</lib>

<lib>${java.home}/lib/jce.jar</lib>

</libs>

</configuration>

</plugin>

  
# ----------------------------------
#  通过指定数量的优化能执行
#  -optimizationpasses n
# ----------------------------------
-optimizationpasses 3

# ----------------------------------
#   混淆时不会产生形形色色的类名 
#   -dontusemixedcaseclassnames
# ----------------------------------
-dontusemixedcaseclassnames
# ----------------------------------
#      指定不去忽略非公共的库类
#  -dontskipnonpubliclibraryclasses
# ----------------------------------
#-dontskipnonpubliclibraryclasses

# ----------------------------------
#       不预校验
#    -dontpreverify
# ----------------------------------
# -dontpreverify

# ----------------------------------
#      输出生成信息
#       -verbose
# ----------------------------------
-verbose

#混淆时应用侵入式重载 
-overloadaggressively 
 
#优化时允许访问并修改有修饰符的类和类的成员 
-allowaccessmodification
#确定统一的混淆类的成员名称来增加混淆 
-useuniqueclassmembernames



#这里添加你不需要混淆的类
-keep  class cn.sunline.test.Test {*;}  

-keep public class * extends  javax.servlet.Servlet
 
-keepattributes **
 

#-keepnames class * implements java.io.Serializable
# ---------保护所有实体中的字段名称----------
-keepclassmembers class * implements java.io.Serializable {
    <fields>;
}

# --------- 保护类中的所有方法名 ------------
-keepclassmembers class * {
	public <methods>;
}

 



版权声明:本文为qq27456026原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。