2016-09-18 47 views
0

我使用Proguard插件來混淆我的項目,它使用JavaFX。 問題是,.fxml文件中的Ids未被混淆,因此無法連接到控制器。 已經嘗試谷歌,沒有成功... 任何想法? Proguard的配置:Java(JavaFX):Maven Proguard不會模糊FX Ids

<plugin> 
      <groupId>com.github.wvengen</groupId> 
      <artifactId>proguard-maven-plugin</artifactId> 
      <version>2.0.11</version> 
      <executions> 
       <execution> 
        <phase>package</phase> 
        <goals> 
         <goal>proguard</goal> 
        </goals> 
       </execution> 
      </executions> 
      <configuration> 
       <obfuscate>true</obfuscate> 
       <injar>${project.build.finalName}.jar</injar> 
       <outjar>${project.build.finalName}-final.jar</outjar> 
       <includeDependency>true</includeDependency> 
       <options> 
        <option>-keep public class com.skriptide.main.Main { public static void 
         main(java.lang.String[]); } 
        </option> 
        <option>-keepattributes Signature,*Annotation*,Exceptions</option> 
        <option>-dontusemixedcaseclassnames</option> 
        <option>-dontskipnonpubliclibraryclasses</option> 
        <option>-verbose</option> 
       </options> 
       <libs> 
        <lib>${java.home}/lib/rt.jar</lib> 
        <lib>${java.home}/lib/jce.jar</lib> 
        <lib>${java.home}/lib/ext/jfxrt.jar</lib> 
        <lib>${java.home}/lib/jfxswt.jar</lib> 
       </libs> 
       <assembly> 
        <inclusions> 
         <inclusion> 
          <groupId>org.ini4j</groupId> 
          <artifactId>ini4j</artifactId> 
          <library>true</library> 
         </inclusion> 
         <inclusion> 
          <groupId>org.fxmisc.richtext</groupId> 
          <artifactId>richtextfx</artifactId> 
          <library>true</library> 
         </inclusion> 
         <inclusion> 
          <groupId>org.json</groupId> 
          <artifactId>json</artifactId> 
          <library>true</library> 
         </inclusion> 
         <inclusion> 
          <groupId>org.yaml</groupId> 
          <artifactId>snakeyaml</artifactId> 
          <library>true</library> 
         </inclusion> 
         <inclusion> 
          <groupId>com.google.guava</groupId> 
          <artifactId>guava</artifactId> 
          <library>true</library> 
         </inclusion> 
        </inclusions> 
       </assembly> 
       <archive> 
        <manifest> 
         <mainClass>com.skriptide.main.Main</mainClass> 
        </manifest> 
       </archive> 
      </configuration> 
      <dependencies> 
       <dependency> 
        <groupId>net.sf.proguard</groupId> 
        <artifactId>proguard-base</artifactId> 
        <version>5.2.1</version> 
        <scope>runtime</scope> 
       </dependency> 
      </dependencies> 
     </plugin> 

感謝

回答

0

你需要指導的ProGuard也在.fxml文件重命名混淆的類名。假設它們已經包含在原始jar文件中,則可以嘗試將以下選項添加到您的proguard配置中:

<options> 
    ... 
    <option>-adaptresourcefilecontents **.fxml</option> 
    ... 
</options>