maven 代码混淆

proguard代码混淆

<!-- Build Settings -->
 <build>
 <plugins>
 <plugin>
 <groupId>com.github.wvengen</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>
 </libs>
 <addMavenDescriptor>false</addMavenDescriptor>
 </configuration>
 <dependencies> 
 <!-- 使用5.2.1版本来混淆 -->
 <dependency>
 <groupId>net.sf.proguard</groupId>
 <artifactId>proguard</artifactId>
 <version>5.2.1</version>
 <scope>runtime</scope>
 </dependency>
 </dependencies> 
 </plugin>
 </plugins>
 </build>
 <!-- Build Settings -->

Proguard.conf

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

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

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

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

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

#设置源文件中给定的字符串常量
-renamesourcefileattribute SourceFile
# 保护给定的可选属性,例如LineNumberTable, LocalVariableTable, SourceFile, Deprecated, Synthetic, Signature, and InnerClasses.
-keepattributes Exceptions,InnerClasses,Signature,Deprecated,
 SourceFile,LineNumberTable,*Annotation*,EnclosingMethod

-keep public class * {
 public protected *;
}
-dontskipnonpubliclibraryclassmembers

-keepattributes Exceptions,InnerClasses,Signature,Deprecated,
 SourceFile,LineNumberTable,*Annotation*,EnclosingMethod

-keep public class * {
 public protected *;
}

-keepclassmembernames class * {
 java.lang.Class class$(java.lang.String);
 java.lang.Class class$(java.lang.String, boolean);
}

-keepclasseswithmembernames class * {
 native &lt;methods&gt;;
}

-keepclassmembers,allowoptimization enum * {
 public static **[] values();
 public static ** valueOf(java.lang.String);
}

-keepclassmembers class * implements java.io.Serializable {
 static final long serialVersionUID;
 private static final java.io.ObjectStreamField[] serialPersistentFields;
 private void writeObject(java.io.ObjectOutputStream);
 private void readObject(java.io.ObjectInputStream);
 java.lang.Object writeReplace();
 java.lang.Object readResolve();
}
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值