1

我的项目基于activeweb + activejdbc,并将db migrator放在应用程序中,我只想app.util.SecretClass通过proguard混淆一个类(命名)。以下pom.xml列表:

            <plugin>
                <groupId>com.github.wvengen</groupId>
                <artifactId>proguard-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals><goal>proguard</goal></goals>
                    </execution>
                </executions>
                <configuration>
                    <proguardVersion>6.1.1</proguardVersion>
                    <!-- 
                    <injar>${project.build.finalName}.jar</injar>
                    -->
                    <injar>classes</injar>
                    <outjar>${project.build.finalName}.jar</outjar>
                    <obfuscate>true</obfuscate>
                    <options>
                       <option>-ignorewarnings</option>
                        <option>-dontshrink</option>
                        <option>-dontoptimize</option>

                        <option>-keep class !app.util.SecretClass { *; }</option>
                        <option>-keep class javax.crypto.**</option>
                        <option>-keep class org.javalite.db_migrator.DbUtils { *; }</option>
                        <option>-dontwarn javax.crypto.**</option>
                        <option>-dontwarn org.javalite.db_migrator.DbUtils </option>

                    </options>
                    <libs>
                        <!-- Include main JAVA library required.-->
                        <lib>${java.home}/lib/rt.jar</lib>
                    </libs>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>net.sf.proguard</groupId>
                        <artifactId>proguard-base</artifactId>
                        <version>6.1.1</version>
                    </dependency>
                </dependencies>
            </plugin>

运行时mvn package,它会打印警告

 [proguard] Note: org.javalite.db_migrator.DbUtils accesses a method 'close()' dynamically
 [proguard]       Maybe this is library method 'com.fasterxml.jackson.core.JsonParser { void close(); }'
 [proguard]       Maybe this is library method 'com.fasterxml.jackson.core.base.GeneratorBase { void close(); }'
 [proguard]       Maybe this is library method 'com.fasterxml.jackson.core.base.ParserBase { void close(); }'
 [proguard]       Maybe this is library method 'com.fasterxml.jackson.core.base.ParserMinimalBase { void close(); }'
 [proguard]       Maybe this is library method 'com.fasterxml.jackson.core.io.MergedStream { void close(); }'
 [proguard]       Maybe this is library method 'com.fasterxml.jackson.core.io.SegmentedStringWriter { void close(); }'
 [proguard]       Maybe this is library method 'com.fasterxml.jackson.core.io.UTF32Reader { void close(); }'
 [proguard]       Maybe this is library method 'com.fasterxml.jackson.core.io.UTF8Writer { void close(); }'
 [proguard]       Maybe this is library method 'com.fasterxml.jackson.core.json.UTF8JsonGenerator { void close(); }'
...
 [proguard] Note: there were 1 accesses to class members by means of reflection.
 [proguard]       You should consider explicitly keeping the mentioned class members
 [proguard]       (using '-keep' or '-keepclassmembers').
 [proguard]       (http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclassmember)
 [proguard] Note: you're ignoring all warnings!

我很困惑

  1. app.util.SecretClass没有引用任何类org.javalite
  2. 我确实在该部分org.javalite中不混淆。options

我应该写什么混淆规则来避免这样的警告?谢谢!

4

0 回答 0