Proguard无法阅读课程



我有一个使用番石榴的项目,问题是番石榴占用了很多空间,所以我使用了他们在github文档中建议的proguard。

问题是,一旦我完成了我的pom.xml文件,并且我创建了目标清理包,它就不会在我的目标进程中构建。

[INFO] Attaching shaded artifact.
[INFO] 
[INFO] --- proguard-maven-plugin:2.0.4:proguard (default) @ Project ---
[INFO] execute ProGuard [-injars, 'C:UsersAssim ZemouchiIdeaProjectsProjectsProject - DiscordtargetProject-1.0.0-shaded.jar'(!META-INF/maven/**), -outjars, 'C:UsersAssim ZemouchiIdeaProjectsClientProjectsProject - DiscordtargetProject-1.0.0-small.jar', -include, 'C:UsersAssim ZemouchiIdeaProjectsClientProjectsProject - Discordlibconfig.pro', -libraryjars, 'C:UsersAssim Zemouchi.m2repositorynetdv8tionJDA4.2.0_214JDA-4.2.0_214.jar', -libraryjars, 'C:UsersAssim Zemouchi.m2repositoryorgjetbrainsannotations16.0.1annotations-16.0.1.jar', -libraryjars, 'C:UsersAssim Zemouchi.m2repositoryorgslf4jslf4j-api1.7.25slf4j-api-1.7.25.jar', -libraryjars, 'C:UsersAssim Zemouchi.m2repositorycomneovisionariesnv-websocket-client2.10nv-websocket-client-2.10.jar', -libraryjars, 'C:UsersAssim Zemouchi.m2repositorycomsquareupokhttp3okhttp3.13.0okhttp-3.13.0.jar', -libraryjars, 'C:UsersAssim Zemouchi.m2repositorycomsquareupokiookio1.17.2okio-1.17.2.jar', -libraryjars, 'C:UsersAssim Zemouchi.m2repositoryorgapachecommonscommons-collections44.1commons-collections4-4.1.jar', -libraryjars, 'C:UsersAssim Zemouchi.m2repositorynetsftrove4jtrove4j3.0.3trove4j-3.0.3.jar', -libraryjars, 'C:UsersAssim ZemouchiIdeaProjectsProjectsProject - DiscordlibGAO.jar', -libraryjars, 'C:UsersAssim Zemouchi.m2repositorycomsparkjavaspark-core2.9.3spark-core-2.9.3.jar', -libraryjars, 'C:UsersAssim Zemouchi.m2repositoryorgeclipsejettyjetty-server9.4.31.v20200723jetty-server-9.4.31.v20200723.jar', -libraryjars, 'C:UsersAssim Zemouchi.m2repositoryorgeclipsejettyjetty-http9.4.31.v20200723jetty-http-9.4.31.v20200723.jar', -libraryjars, 'C:UsersAssim Zemouchi.m2repositoryorgeclipsejettyjetty-util9.4.31.v20200723jetty-util-9.4.31.v20200723.jar', -libraryjars, 'C:UsersAssim Zemouchi.m2repositoryorgeclipsejettyjetty-io9.4.31.v20200723jetty-io-9.4.31.v20200723.jar', -libraryjars, 'C:UsersAssim Zemouchi.m2repositoryorgeclipsejettyjetty-webapp9.4.31.v20200723jetty-webapp-9.4.31.v20200723.jar', -libraryjars, 'C:UsersAssim Zemouchi.m2repositoryorgeclipsejettyjetty-xml9.4.31.v20200723jetty-xml-9.4.31.v20200723.jar', -libraryjars, 'C:UsersAssim Zemouchi.m2repositoryorgeclipsejettyjetty-servlet9.4.31.v20200723jetty-servlet-9.4.31.v20200723.jar', -libraryjars, 'C:UsersAssim Zemouchi.m2repositoryorgeclipsejettyjetty-security9.4.31.v20200723jetty-security-9.4.31.v20200723.jar', -libraryjars, 'C:UsersAssim Zemouchi.m2repositoryorgeclipsejettywebsocketwebsocket-server9.4.31.v20200723websocket-server-9.4.31.v20200723.jar', -libraryjars, 'C:UsersAssim Zemouchi.m2repositoryorgeclipsejettywebsocketwebsocket-common9.4.31.v20200723websocket-common-9.4.31.v20200723.jar', -libraryjars, 'C:UsersAssim Zemouchi.m2repositoryorgeclipsejettywebsocketwebsocket-client9.4.31.v20200723websocket-client-9.4.31.v20200723.jar', -libraryjars, 'C:UsersAssim Zemouchi.m2repositoryorgeclipsejettyjetty-client9.4.31.v20200723jetty-client-9.4.31.v20200723.jar', -libraryjars, 'C:UsersAssim Zemouchi.m2repositoryorgeclipsejettywebsocketwebsocket-servlet9.4.31.v20200723websocket-servlet-9.4.31.v20200723.jar', -libraryjars, 'C:UsersAssim Zemouchi.m2repositoryorgeclipsejettywebsocketwebsocket-api9.4.31.v20200723websocket-api-9.4.31.v20200723.jar', -libraryjars, 'C:UsersAssim Zemouchi.m2repositorycomgooglecodegsongson2.8.6gson-2.8.6.jar', -libraryjars, 'C:UsersAssim Zemouchi.m2repositoryiogithubportlekconfigs-core4.9.9.6configs-core-4.9.9.6.jar', -libraryjars, 'C:UsersAssim Zemouchi.m2repositoryiogithubportlekreflection3.7reflection-3.7.jar', -libraryjars, 'C:UsersAssim Zemouchi.m2repositoryiogithubportlekreplaceable1.6replaceable-1.6.jar', -libraryjars, 'C:UsersAssim Zemouchi.m2repositoryiogithubportlekversion1.6version-1.6.jar', -libraryjars, 'C:UsersAssim Zemouchi.m2repositoryiogithubportlekmapentry1.8mapentry-1.8.jar', -libraryjars, 'C:UsersAssim Zemouchi.m2repositorymecarleslcSimple-YAMLSimple-Configuration1.7.1Simple-Configuration-1.7.1.jar', -libraryjars, 'C:UsersAssim Zemouchi.m2repositoryiogithubportlekconfigs-yaml4.9.9.6configs-yaml-4.9.9.6.jar', -libraryjars, 'C:UsersAssim Zemouchi.m2repositorymecarleslcSimple-YAMLSimple-Yaml1.7.1Simple-Yaml-1.7.1.jar', -libraryjars, 'C:UsersAssim Zemouchi.m2repositoryorgyamlsnakeyaml1.26snakeyaml-1.26.jar', -libraryjars, 'C:UsersAssim Zemouchi.m2repositoryorgjsoupjsoup1.8.3jsoup-1.8.3.jar', -libraryjars, 'C:UsersAssim Zemouchi.m2repositorycomatlassiancommonmarkcommonmark.15.2commonmark-0.15.2.jar', -libraryjars, 'C:UsersAssim Zemouchi.m2repositoryorgniborautolinkautolink.10.0autolink-0.10.0.jar', -libraryjars, 'C:UsersAssim Zemouchi.m2repositorymysqlmysql-connector-java8.0.22mysql-connector-java-8.0.22.jar', -libraryjars, 'C:UsersAssim Zemouchi.m2repositorycomgoogleprotobufprotobuf-java3.11.4protobuf-java-3.11.4.jar', -libraryjars, 'C:UsersAssim Zemouchi.m2repositorycomzaxxerHikariCP3.4.5HikariCP-3.4.5.jar', -libraryjars, 'C:UsersAssim Zemouchi.m2repositorycomgoogleguavaguava30.0-jreguava-30.0-jre.jar', -libraryjars, 'C:UsersAssim Zemouchi.m2repositorycomgoogleguavafailureaccess1.0.1failureaccess-1.0.1.jar', -libraryjars, 'C:UsersAssim Zemouchi.m2repositorycomgoogleguavalistenablefuture9999.0-empty-to-avoid-conflict-with-guavalistenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar', -libraryjars, 'C:UsersAssim Zemouchi.m2repositorycomgooglecodefindbugsjsr3053.0.2jsr305-3.0.2.jar', -libraryjars, 'C:UsersAssim Zemouchi.m2repositoryorgcheckerframeworkchecker-qual3.5.0checker-qual-3.5.0.jar', -libraryjars, 'C:UsersAssim Zemouchi.m2repositorycomgoogleerrorproneerror_prone_annotations2.3.4error_prone_annotations-2.3.4.jar', -libraryjars, 'C:UsersAssim Zemouchi.m2repositorycomgooglej2objcj2objc-annotations1.3j2objc-annotations-1.3.jar', -libraryjars, 'C:UsersAssim Zemouchi.m2repositorynetsfproguardproguard-base6.2.2proguard-base-6.2.2.jar', -libraryjars, 'C:Program FilesJavajdk1.8.0_251jre/lib/rt.jar', -libraryjars, 'C:Program FilesJavajdk1.8.0_251jre/lib/jsse.jar', -printmapping, 'C:UsersAssim ZemouchiIdeaProjectsClientProjectsProject - Discordtargetproguard_map.txt', -printseeds, 'C:UsersAssim ZemouchiIdeaProjectsClientProjectsProject - Discordtargetproguard_seeds.txt']
[INFO] proguard jar: C:UsersAssim Zemouchi.m2repositorynetsfproguardproguard4.3proguard-4.3.jar
[proguard] ProGuard, version 4.3
[proguard] Reading program jar [C:UsersAssim ZemouchiIdeaProjectsProjectsProject - DiscordtargetProject-1.0.0-shaded.jar] (filtered)
[proguard] Error: Can't read [C:UsersAssim ZemouchiIdeaProjectsClientProjectsProject - DiscordtargetProject-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:

<properties>
<project.build.finalName>Project_Discord_${project.version}</project.build.finalName>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<build>
<defaultGoal>clean package</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.15</version>
<configuration>
<argLine>-Dfile.encoding=UTF-8</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>shaded</shadedClassifierName>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>fr.misterassm.KamasBot</mainClass>
</transformer>
</transformers>
</configuration>
</plugin>
<plugin>
<groupId>com.pyx4me</groupId>
<artifactId>proguard-maven-plugin</artifactId>
<version>2.0.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>proguard</goal>
</goals>
</execution>
</executions>
<configuration>
<proguardVersion>4.3</proguardVersion>
<obfuscate>true</obfuscate>
<injar>${project.build.finalName}-shaded.jar</injar>
<outjar>${project.build.finalName}-small.jar</outjar>
<proguardInclude>${basedir}/lib/config.pro</proguardInclude>
<libs>
<lib>${java.home}/lib/rt.jar</lib>
<lib>${java.home}/lib/jsse.jar</lib>
</libs>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>${basedir}/src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>*</include>
</includes>
</resource>
</resources>
</build>
<dependencies>
...

<!-- 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>
</dependencies>

(Unsupported version number [52.0] for class format):这是指Java的类格式,在本例中为Java 1.8。

我看到您指定使用proguard版本4.3,该版本似乎已于2008年发布。这比Java 1.8的发布早了六年。所以Proguard版本不支持这些类也就不足为奇了。

更改此行:

<proguardVersion>4.3</proguardVersion>

截至本文撰写之时,progaurd的最新版本为7.0.0。

相关内容

  • 没有找到相关文章

最新更新