我试图混淆我生成的项目 JAR 文件,但没有成功。所以我试图减少所有步骤以找出发生了什么,我意识到我根本无法使用 yguard,我不知道为什么。也许是一个 Eclipse 糟糕的配置......
我在 pom.xml 中添加了 yguard
<dependency>
<groupId>com.yworks</groupId>
<artifactId>yguard</artifactId>
<version>3.0.0</version>
</dependency>
我在 pom.xml 和执行(在打包期间)中添加了试图混淆单个 JAR 文件
<execution>
<id>Obfuscate</id>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<property name="runtime-classpath" refid="maven.runtime.classpath"/>
<taskdef name="yguard" classname="com.yworks.yguard.YGuardTask" classpath="${runtime-classpath}"/>
<yguard>
<inoutpair in="C:/test/example.jar" out="C:/test/example_obfuscated.jar" />
<shrink/>
</yguard>
</tasks>
</configuration>
</execution>
“example.jar”正确放置在“C:/test”中,只是一个手动生成的类文件(为了简化我的混淆测试)。
jar cf example.jar myClass.class
当我运行任何包含包阶段的 MAVEN 进程时,执行失败并且我收到以下控制台消息:
main:
[shrink] yGuard Shrinker v3.0.0 - http://www.yworks.com/products/yguard
[shrink] no entrypoints given - using class access public and protected on all inoutpairs.
[shrink] ERROR: class com.yworks.yshrink.model.ModelVisitor has interface org.objectweb.asm.ClassVisitor as super class
[shrink] class com.yworks.yshrink.model.ModelVisitor has interface org.objectweb.asm.ClassVisitor as super class
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 26.382 s
[INFO] Finished at: 2022-01-20T14:32:24+01:00
[INFO] Final Memory: 54M/714M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (Obfuscate) on project grb: An Ant BuildException has occured: yShrink encountered an unknown severe problem!
[ERROR] around Ant part ...<yguard>... @ 6:11 in C:\espacio_trabajo_7\eclipse\eclipse_2019-09\workspace\trunk\grb\target\antrun\build-main.xml: class com.yworks.yshrink.model.ModelVisitor has interface org.objectweb.asm.ClassVisitor as super class
[ERROR] -> [Help 1]`
任何想法?我非常感谢您能提供的任何帮助。
伊万