2012-12-04 55 views
1

之前,我有一個像下面插件配置:MVN的ProGuard:是否有可能模糊處理依賴複製

<project> 
    ... 
    <build> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-dependency-plugin</artifactId> 
      <version>2.6</version> 
      <executions> 
       <execution> 
        <id>copy-dependencies</id> 
        <phase>package</phase> 
        <goals> 
         <goal>copy-dependencies</goal> 
        </goals> 
        <configuration> 
         <outputDirectory>${project.build.directory}/libs</outputDirectory> 
         <overWriteReleases>true</overWriteReleases> 
         <overWriteSnapshots>true</overWriteSnapshots> 
         <overWriteIfNewer>true</overWriteIfNewer> 
        </configuration> 
       </execution> 
      </executions> 
     </plugin> 
     <plugin> 
      <groupId>com.pyx4me</groupId> 
      <artifactId>proguard-maven-plugin</artifactId> 
      <version>2.1.0-SNAPSHOT</version> 
      <executions> 
       <execution> 
        <phase>package</phase> 
        <goals> 
         <goal>proguard</goal> 
        </goals> 
       </execution> 
      </executions> 
      <configuration> 
       <proguardVersion>4.8</proguardVersion> 
       <obfuscate>true</obfuscate> 
       <includeDependency>true</includeDependency> 
       <injar>${project.artifactId}-${project.version}.jar</injar> 
       <outjar>${project.artifactId}-${project.version}-obf.jar</outjar> 
       <outputDirectory>${project.build.directory}</outputDirectory> 
       <maxMemory>256m</maxMemory>    
       <options> 
        <option>-keepclasseswithmembers class **, !some.specific.package.** { *; }</option> 
        <option>-keep public class some.specific.package.Main { public *; public static *; }</option> 
        <option>-allowaccessmodification</option> 
        <option>-dontskipnonpubliclibraryclasses</option> 
        <option>-dontskipnonpubliclibraryclassmembers</option> 
        <option>-dontwarn org.apache.log4j.**</option> 
       </options> 
       <libs> 
        <lib>${java.home}/lib/rt.jar</lib> 
        <lib>${java.home}/lib/javaws.jar</lib> 
        <lib>${javafx_home}/lib/jfxrt.jar</lib> 
       </libs>  
      </configuration> 

      <dependencies> 
       <dependency> 
        <groupId>net.sf.proguard</groupId> 
        <artifactId>proguard-base</artifactId> 
        <version>4.8</version> 
       </dependency> 
      </dependencies> 
     </plugin> 
    </build> 
... 
</project> 

我想混淆特定包some.specific.package的罐子和它們的依賴(複製之前)。有可能做到嗎?

回答

4

您是否嘗試使用命令-keeppackagenames否定您希望混淆的軟件包(!)?我嘗試了以下內容,結果發現只是包org.neo4j.cineasts.domain被混淆了。請看下圖:

<configuration> 
       <proguardVersion>4.8</proguardVersion> 
       <obfuscate>true</obfuscate> 
       <includeDependency>true</includeDependency> 
       <injar>${project.artifactId}-${project.version}.jar</injar> 
       <outjar>${project.artifactId}-${project.version}-obf.jar</outjar> 
       <outputDirectory>${project.build.directory}</outputDirectory> 
       <maxMemory>256m</maxMemory> 
       <options> 
        <option>-keep public class org.neo4j.cineasts.controller.** { public *; public static *; }</option> 
        <option>-keeppackagenames !org.neo4j.cineasts.domain</option> 
        <option>-allowaccessmodification</option> 
        <option>-dontskipnonpubliclibraryclasses</option> 
        <option>-dontskipnonpubliclibraryclassmembers</option> 
       </options> 
       <libs> 
        <lib>C:/devtools/Java/jdk1.6.0_29_64/jre/lib/rt.jar</lib> 
        <lib>C:/devtools/Java/jdk1.6.0_29_64/jre/lib/javaws.jar</lib> 
       </libs> 
      </configuration> 

最好成績,邁克爾

+0

我想混淆過於依賴 – CAMOBAP

相關問題