使用Maven使用proguard的Spring项目混淆

时间:2016-07-12 07:06:01

标签: spring maven proguard

是否有任何使用proguard& amp;混淆Spring应用程序的好例子妈妈?我尝试在pom.xml中添加此代码段。我的项目正在编译和运行,但没有被混淆。 我能够反编译我的war文件并查看代码。是否需要任何设置来混淆生成的文件??

            <!-- ProGuard obfuscation plugin -->
            <plugin>
                <groupId>com.github.wvengen</groupId>
                <artifactId>proguard-maven-plugin</artifactId>
                <version>2.0.6</version>
                <executions>
                    <execution>
                        <configuration>
                            <obfuscate>true</obfuscate>
                            <proguardVersion>5.2.1</proguardVersion>
                            <options>
                                <option>-target 1.7</option>
                                <option>-dontnote</option>
                                <option>-dontpreverify</option>
                                <option>-dontskipnonpubliclibraryclasses</option>
                                <option>-dontskipnonpubliclibraryclassmembers</option>
                                <option>-allowaccessmodification</option>
                                <option>-repackageclasses ''</option>
                                <option>-keep public class ${mainClass} { public static void
                                    main(java.lang.String[]); }</option>
                                <option>-keepattributes
                                    InnerClasses,Signature,LineNumberTable,*Annotation*,EnclosingMethod</option>
                                <option>-keepclassmembers enum * { public static **[] values();
                                    public static ** valueOf(java.lang.String); }</option>
                                <option>-dontwarn org.spout.**</option>
                                <option>-dontwarn com.google.**</option>
                            </options>

                            <proguardInclude>${basedir}/proguard.conf</proguardInclude>
                            <includeDependency>false</includeDependency>
                            <libs>
                                <lib>${java.home}/lib/jce.jar</lib>
                                <lib>${java.home}/lib/jfxrt.jar</lib>
                                <lib>${java.home}/lib/rt.jar</lib>
                            </libs>
                        </configuration>
                        <phase>package</phase>
                        <goals>
                            <goal>proguard</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>


                    <dependency>
                        <groupId>net.sf.proguard</groupId>
                        <artifactId>proguard-base</artifactId>
                        <version>5.2.1</version>
                        <scope>runtime</scope>
                    </dependency>
                    <dependency>
                        <groupId>net.sf.proguard</groupId>
                        <artifactId>proguard</artifactId>
                        <version>4.4</version>
                    </dependency>


                </dependencies>
            </plugin>

0 个答案:

没有答案