proguard无法读取类

8oomwypt  于 2021-07-11  发布在  Java
关注(0)|答案(1)|浏览(444)

我有一个使用guava的项目,问题是guava占用了很多空间,所以我使用了proguard,正如他们在github文档中建议的那样。
问题是,一旦我完成任务 pom.xml 文件和maven目标清理包,它不会在我的目标进程中生成。

[INFO] Attaching shaded artifact.
[INFO] 
[INFO] --- proguard-maven-plugin:2.0.4:proguard (default) @ Project ---
[INFO] execute ProGuard [-injars, 'C:\Users\Assim Zemouchi\IdeaProjects\Projects\Project - Discord\target\Project-1.0.0-shaded.jar'(!META-INF/maven/**), -outjars, 'C:\Users\Assim Zemouchi\IdeaProjects\Client\Projects\Project - Discord\target\Project-1.0.0-small.jar', -include, 'C:\Users\Assim Zemouchi\IdeaProjects\Client\Projects\Project - Discord\lib\config.pro', -libraryjars, 'C:\Users\Assim Zemouchi\.m2\repository\net\dv8tion\JDA\4.2.0_214\JDA-4.2.0_214.jar', -libraryjars, 'C:\Users\Assim Zemouchi\.m2\repository\org\jetbrains\annotations\16.0.1\annotations-16.0.1.jar', -libraryjars, 'C:\Users\Assim Zemouchi\.m2\repository\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar', -libraryjars, 'C:\Users\Assim Zemouchi\.m2\repository\com\neovisionaries\nv-websocket-client\2.10\nv-websocket-client-2.10.jar', -libraryjars, 'C:\Users\Assim Zemouchi\.m2\repository\com\squareup\okhttp3\okhttp\3.13.0\okhttp-3.13.0.jar', -libraryjars, 'C:\Users\Assim Zemouchi\.m2\repository\com\squareup\okio\okio\1.17.2\okio-1.17.2.jar', -libraryjars, 'C:\Users\Assim Zemouchi\.m2\repository\org\apache\commons\commons-collections4\4.1\commons-collections4-4.1.jar', -libraryjars, 'C:\Users\Assim Zemouchi\.m2\repository\net\sf\trove4j\trove4j\3.0.3\trove4j-3.0.3.jar', -libraryjars, 'C:\Users\Assim Zemouchi\IdeaProjects\Projects\Project - Discord\lib\GAO.jar', -libraryjars, 'C:\Users\Assim Zemouchi\.m2\repository\com\sparkjava\spark-core\2.9.3\spark-core-2.9.3.jar', -libraryjars, 'C:\Users\Assim Zemouchi\.m2\repository\org\eclipse\jetty\jetty-server\9.4.31.v20200723\jetty-server-9.4.31.v20200723.jar', -libraryjars, 'C:\Users\Assim Zemouchi\.m2\repository\org\eclipse\jetty\jetty-http\9.4.31.v20200723\jetty-http-9.4.31.v20200723.jar', -libraryjars, 'C:\Users\Assim Zemouchi\.m2\repository\org\eclipse\jetty\jetty-util\9.4.31.v20200723\jetty-util-9.4.31.v20200723.jar', -libraryjars, 'C:\Users\Assim Zemouchi\.m2\repository\org\eclipse\jetty\jetty-io\9.4.31.v20200723\jetty-io-9.4.31.v20200723.jar', -libraryjars, 'C:\Users\Assim Zemouchi\.m2\repository\org\eclipse\jetty\jetty-webapp\9.4.31.v20200723\jetty-webapp-9.4.31.v20200723.jar', -libraryjars, 'C:\Users\Assim Zemouchi\.m2\repository\org\eclipse\jetty\jetty-xml\9.4.31.v20200723\jetty-xml-9.4.31.v20200723.jar', -libraryjars, 'C:\Users\Assim Zemouchi\.m2\repository\org\eclipse\jetty\jetty-servlet\9.4.31.v20200723\jetty-servlet-9.4.31.v20200723.jar', -libraryjars, 'C:\Users\Assim Zemouchi\.m2\repository\org\eclipse\jetty\jetty-security\9.4.31.v20200723\jetty-security-9.4.31.v20200723.jar', -libraryjars, 'C:\Users\Assim Zemouchi\.m2\repository\org\eclipse\jetty\websocket\websocket-server\9.4.31.v20200723\websocket-server-9.4.31.v20200723.jar', -libraryjars, 'C:\Users\Assim Zemouchi\.m2\repository\org\eclipse\jetty\websocket\websocket-common\9.4.31.v20200723\websocket-common-9.4.31.v20200723.jar', -libraryjars, 'C:\Users\Assim Zemouchi\.m2\repository\org\eclipse\jetty\websocket\websocket-client\9.4.31.v20200723\websocket-client-9.4.31.v20200723.jar', -libraryjars, 'C:\Users\Assim Zemouchi\.m2\repository\org\eclipse\jetty\jetty-client\9.4.31.v20200723\jetty-client-9.4.31.v20200723.jar', -libraryjars, 'C:\Users\Assim Zemouchi\.m2\repository\org\eclipse\jetty\websocket\websocket-servlet\9.4.31.v20200723\websocket-servlet-9.4.31.v20200723.jar', -libraryjars, 'C:\Users\Assim Zemouchi\.m2\repository\org\eclipse\jetty\websocket\websocket-api\9.4.31.v20200723\websocket-api-9.4.31.v20200723.jar', -libraryjars, 'C:\Users\Assim Zemouchi\.m2\repository\com\google\code\gson\gson\2.8.6\gson-2.8.6.jar', -libraryjars, 'C:\Users\Assim Zemouchi\.m2\repository\io\github\portlek\configs-core\4.9.9.6\configs-core-4.9.9.6.jar', -libraryjars, 'C:\Users\Assim Zemouchi\.m2\repository\io\github\portlek\reflection\3.7\reflection-3.7.jar', -libraryjars, 'C:\Users\Assim Zemouchi\.m2\repository\io\github\portlek\replaceable\1.6\replaceable-1.6.jar', -libraryjars, 'C:\Users\Assim Zemouchi\.m2\repository\io\github\portlek\version\1.6\version-1.6.jar', -libraryjars, 'C:\Users\Assim Zemouchi\.m2\repository\io\github\portlek\mapentry\1.8\mapentry-1.8.jar', -libraryjars, 'C:\Users\Assim Zemouchi\.m2\repository\me\carleslc\Simple-YAML\Simple-Configuration\1.7.1\Simple-Configuration-1.7.1.jar', -libraryjars, 'C:\Users\Assim Zemouchi\.m2\repository\io\github\portlek\configs-yaml\4.9.9.6\configs-yaml-4.9.9.6.jar', -libraryjars, 'C:\Users\Assim Zemouchi\.m2\repository\me\carleslc\Simple-YAML\Simple-Yaml\1.7.1\Simple-Yaml-1.7.1.jar', -libraryjars, 'C:\Users\Assim Zemouchi\.m2\repository\org\yaml\snakeyaml\1.26\snakeyaml-1.26.jar', -libraryjars, 'C:\Users\Assim Zemouchi\.m2\repository\org\jsoup\jsoup\1.8.3\jsoup-1.8.3.jar', -libraryjars, 'C:\Users\Assim Zemouchi\.m2\repository\com\atlassian\commonmark\commonmark\0.15.2\commonmark-0.15.2.jar', -libraryjars, 'C:\Users\Assim Zemouchi\.m2\repository\org\nibor\autolink\autolink\0.10.0\autolink-0.10.0.jar', -libraryjars, 'C:\Users\Assim Zemouchi\.m2\repository\mysql\mysql-connector-java\8.0.22\mysql-connector-java-8.0.22.jar', -libraryjars, 'C:\Users\Assim Zemouchi\.m2\repository\com\google\protobuf\protobuf-java\3.11.4\protobuf-java-3.11.4.jar', -libraryjars, 'C:\Users\Assim Zemouchi\.m2\repository\com\zaxxer\HikariCP\3.4.5\HikariCP-3.4.5.jar', -libraryjars, 'C:\Users\Assim Zemouchi\.m2\repository\com\google\guava\guava\30.0-jre\guava-30.0-jre.jar', -libraryjars, 'C:\Users\Assim Zemouchi\.m2\repository\com\google\guava\failureaccess\1.0.1\failureaccess-1.0.1.jar', -libraryjars, 'C:\Users\Assim Zemouchi\.m2\repository\com\google\guava\listenablefuture\9999.0-empty-to-avoid-conflict-with-guava\listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar', -libraryjars, 'C:\Users\Assim Zemouchi\.m2\repository\com\google\code\findbugs\jsr305\3.0.2\jsr305-3.0.2.jar', -libraryjars, 'C:\Users\Assim Zemouchi\.m2\repository\org\checkerframework\checker-qual\3.5.0\checker-qual-3.5.0.jar', -libraryjars, 'C:\Users\Assim Zemouchi\.m2\repository\com\google\errorprone\error_prone_annotations\2.3.4\error_prone_annotations-2.3.4.jar', -libraryjars, 'C:\Users\Assim Zemouchi\.m2\repository\com\google\j2objc\j2objc-annotations\1.3\j2objc-annotations-1.3.jar', -libraryjars, 'C:\Users\Assim Zemouchi\.m2\repository\net\sf\proguard\proguard-base\6.2.2\proguard-base-6.2.2.jar', -libraryjars, 'C:\Program Files\Java\jdk1.8.0_251\jre/lib/rt.jar', -libraryjars, 'C:\Program Files\Java\jdk1.8.0_251\jre/lib/jsse.jar', -printmapping, 'C:\Users\Assim Zemouchi\IdeaProjects\Client\Projects\Project - Discord\target\proguard_map.txt', -printseeds, 'C:\Users\Assim Zemouchi\IdeaProjects\Client\Projects\Project - Discord\target\proguard_seeds.txt']
[INFO] proguard jar: C:\Users\Assim Zemouchi\.m2\repository\net\sf\proguard\proguard\4.3\proguard-4.3.jar
 [proguard] ProGuard, version 4.3
 [proguard] Reading program jar [C:\Users\Assim Zemouchi\IdeaProjects\Projects\Project - Discord\target\Project-1.0.0-shaded.jar] (filtered)
 [proguard] Error: Can't read [C:\Users\Assim Zemouchi\IdeaProjects\Client\Projects\Project - Discord\target\Project-1.0.0-shaded.jar(;;;;!META-INF/maven/**)] (Can't process class [fr/misterassm/commands/StatsCommand.class] (Unsupported version number [52.0] for class format))
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  3.895 s
[INFO] Finished at: 2020-11-22T14:34:16+01:00
[INFO] ------------------------------------------------------------------------
[WARNING] The requested profile "artifactory" could not be activated because it does not exist.
[ERROR] Failed to execute goal com.pyx4me:proguard-maven-plugin:2.0.4:proguard (default) on project Project: Obfuscation failed (result=1) -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
``` `(Unsupported version number [52.0] for class format)` 这是我从中得到的,我不明白为什么,我试图从我的项目中删除这个类,但它是另一个类,以后会有同样的问题。
以下是我的pom.xml:
<!-- Guava -->
<dependency>
    <groupId>com.google.guava</groupId>
    <artifactId>guava</artifactId>
    <version>30.0-jre</version>
</dependency>
<!-- Proguard -->
<dependency>
    <groupId>net.sf.proguard</groupId>
    <artifactId>proguard-base</artifactId>
    <version>6.2.2</version>
</dependency>
lsmepo6l

lsmepo6l1#

(Unsupported version number [52.0] for class format) :这是指java的类格式,在本例中是java 1.8。
我看到您指定使用proguard版本4.3,它似乎是在2008年发布的。这比Java1.8发布早了六年。所以proguard版本不支持这些类也就不足为奇了。
更改此行:

<proguardVersion>4.3</proguardVersion>

progaurd的最新版本是7.0.0。

相关问题