我试图混淆我生成的项目JAR文件,但没有成功。所以我试着减少所有的步骤,以找出发生了什么,我意识到我根本不能使用你的护卫,我不知道为什么。也许是月食不好的配置..。
我在我的pom.xml里增加了一个护卫
<dependency>
<groupId>com.yworks</groupId>
<artifactId>yguard</artifactId>
<version>3.0.0</version>
</dependency>我还添加了pom.xml和excution (打包期间),试图混淆单个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]`有什么想法吗?我真的很感激你能提供的任何帮助。
伊万
发布于 2022-01-25 14:26:38
问题也与使用asm工件的其他库有关。所以我不得不做以下几件事:
1-将asm排除在护卫之外
2-将asm添加到我的pom.xml
3-从其他库(在我的示例2库中)排除所有asm引用: 1- jasperreports使用itext和olap4j,它们都使用asm 2- retroweaver。
4-手动添加排除的库
<dependency>
<groupId>com.yworks</groupId>
<artifactId>yguard</artifactId>
<version>3.0.0</version>
<exclusions>
<exclusion>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>7.2</version>
</dependency>
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>6.4.1</version>
<exclusions>
<exclusion>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
</exclusion>
<exclusion>
<groupId>org.olap4j</groupId>
<artifactId>olap4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>net.sourceforge.retroweaver</groupId>
<artifactId>retroweaver</artifactId>
<version>1.2.4</version>
<exclusions>
<exclusion>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.olap4j</groupId>
<artifactId>olap4j</artifactId>
<version>0.9.7.309-JS-3</version>
<exclusions>
<exclusion>
<groupId>net.sourceforge.retroweaver</groupId>
<artifactId>retroweaver</artifactId>
</exclusion>
<exclusion>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
</exclusion>
</exclusions>
</dependency>https://stackoverflow.com/questions/70787231
复制相似问题