gpt4 book ai didi

java - Java(JavaFX): Maven Proguard doesnt obfuscate FX Ids

转载 作者:行者123 更新时间:2023-12-02 11:01:14 25 4
gpt4 key购买 nike

我正在使用Proguard插件来混淆正在使用JavaFX的项目。
问题是,.fxml文件中的ID无法混淆,因此无法连接到 Controller 。
已经在Google上尝试过,没有成功...
有任何想法吗?
Proguard配置:

  <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>

谢谢

最佳答案

您还必须指示ProGuard在.fxml文件中重命名混淆的类名。假设它们已经包含在原始jar文件中,则可以尝试将以下选项添加到您的proguard配置中:

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

关于java - Java(JavaFX): Maven Proguard doesnt obfuscate FX Ids,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39553032/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com