maven插件proguard混洗代码

 Java代码混淆工具ProGuard是比较流行的,它主要的功能包含:缩减代码、优化代码、混淆代码,而且这三部分代码都是可以配置开启/关闭的。下面将介绍使用maven,快速集成。

//pom中添加

                com.github.wvengen
                proguard-maven-plugin
                2.0.7
                
                    
                        process-classes
                        
                            proguard
                        
                    
                
                
                    classes
                    true
                    ${basedir}/proguard.conf
                    pg
                    
                    ${project.build.finalName}-pg
                     
                        
                        
                        
                        
                        
                        
                        
                        
                        

                        
                        
                        
                        

                        
                    
                    
                        ${java.home}/lib/rt.jar
                    
                
                
                    
                        net.sf.proguard
                        proguard-base
                        5.2.1
                    
                
            

在工程的根目录中(与src同级目录),调整proguard.conf配置

# ----------------------------------  
#   混淆时不会产生形形色色的类名   
#   -dontusemixedcaseclassnames  
# ----------------------------------  
-dontusemixedcaseclassnames

-keepparameternames
-keep class com.kxtx.utils.** {public ;}
-keep class com.kxtx.batch.** {public ;}
-keep class com.kxtx.cache.** {public ;}
-keepnames public class com.kxtx.controller.*
-keep class com.kxtx.controller.* {public ;}
-keep class com.kxtx.controls.** {public ;}
-keep class com.kxtx.core.utils.** {public ;}
-keepnames public class com.kxtx.exception.*
-keep class com.kxtx.init.** {public ;}
-keep class com.kxtx.java.beans.** {public ;}
-keep class com.kxtx.mybatis.** {public ;}
-keepclassmembers enum com.kxtx.mybatis.annotation.CommonFieldType { *;}
-keep class com.kxtx.security.** {public ;}
-keep class com.kxtx.spring.beans.** {public ;}
-keep class com.kxtx.util.** {public ;}
-keep class com.kxtx.validation.domain.** {public ;}
-keep class com.kxtx.validation.domain.support.* {protected ;}
-keep class com.kxtx.validation.annotation.** {public ;}
-keep class com.kxtx.validation.dao.** {public ;}
-keep class com.kxtx.validation.service.** {public ;}
-keep class com.kxtx.validation.web.advice.** {public ;}
-keep class com.kxtx.validation.utils.** {public ;}
-keep class com.kxtx.validation.validator.AbstractCustomValidator {protected ;}
-keep class com.kxtx.web.filter.** {public ;}
-keep class com.kxtx.web.handler.** {public ;}
-keep class com.kxtx.web.session.** {public ;}
-keep class com.kxtx.web.* {public ;}
-keep class com.kxtx.web.vo.* {public ;}
-keepclassmembers class * {
    public static ;
}
-keep class com.kxtx.mybatis.service.impl.BaseServiceImpl{
    public protected *;
}
-keep class com.kxtx.areas.** {public ;}
-keep class com.kxtx.areas.model.* { private ;}
-keep class com.kxtx.utils.UserUtils { *;}
-keep class com.kxtx.web.session.UserInfoAttributesConverter{ *;}
-keep class com.kxtx.converter.** {public ;}
-keep class com.kxtx.vo.UniqueVo { *;}-keep class om.kxtx.security.function.authentication.** {public ;}

 

你可能感兴趣的:(Java,工具)