ProGuard + Maven with Java 7

后端 未结 3 1625
盖世英雄少女心
盖世英雄少女心 2021-02-01 20:57

I\'m trying to make ProGuard part of our Maven build process. The problem is that the official Maven plugin is using ProGuard 4.3, which doesn\'t support Java 7. Is there any ea

3条回答
  •  野的像风
    2021-02-01 21:09

    I use the proguard-maven-plugin from com.github.wvengen. Note the different groupId. That way I can use the latest proguard-base artifact 5.0. Both are in Maven Central. Here's how the proguard-base portion in my pom.xml looks right now:

    Parent pom.xml:

    
        
            
                
                    com.github.wvengen
                    proguard-maven-plugin
                    2.0.8
                    
                        
                            net.sf.proguard
                            proguard-base
                            5.0
                            runtime
                        
                    
                
    [...]
    

    Here's the rest from my child pom.xml, but you probably want to modify that:

     
        
            
                com.github.wvengen
                proguard-maven-plugin
                
                    
                        process-classes-with-proguard
                        process-classes
                        
                            proguard
                        
                        
                            256m
                            classes
                            
                                ${rt.jar.path}
                                ${jsse.jar.path}
                            
                            true
                            true
                            false
                            ${project.basedir}/proguard.conf
                        
                    
                
            
    

    UPDATE: For my Android projects I'm not using a dedicated Proguard plugin like proguard-maven-plugin since the android-maven-plugin handles the ProGuard obfuscation itself, and is integrated better into the build process for Android.

提交回复
热议问题