proguard-maven-plugin
proguard-maven-plugin copied to clipboard
org.apache.maven.plugin.MojoExecutionException: Obfuscation failed (result=1)
When I built my project, use 'mvn clean package -e -X‘, I can not success.
How can I solve it? Is This a version problem?
The details about pom.xml is:
<plugin>
<groupId>com.github.wvengen</groupId>
<artifactId>proguard-maven-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals><goal>proguard</goal></goals>
</execution>
</executions>
<configuration>
<proguardVersion>6.2.2</proguardVersion>
<injar>${project.build.finalName}.jar</injar>
<outjar>${project.build.finalName}-proguard.jar</outjar>
<!--<proguardInclude>${project.basedir}/proguard.cfg</proguardInclude>-->
<obfuscate>true</obfuscate>
<options>
<option>-dontshrink</option>
<option>-dontoptimize</option>
<!--<option>-keepdirectories</option>-->
<option>-keepattributes Exceptions,InnerClasses,Signature,Deprecated,
SourceFile,LineNumberTable, *Annotation*,EnclosingMethod
</option>
<option>-adaptclassstrings</option>
<option>
-keep class com.center.BootstrapApplication { *; }
</option>
<option>-keepnames interface ** { *; }</option>
<option>-keepnames enum ** { *; }</option>
<option>-keepnames class * implements com.base.interfaces.BaseEntry{ *; }</option>
<option>-keepclassmembers public class *{void set*(***);*** get*();}</option>
<option>-keep interface * extends * { *; }</option>
<!--<option>-printseeds proguard.txt</option>-->
<option>
-keep class * {
@org.springframework.beans.factory.annotation.Autowired *;
@org.springframework.beans.factory.annotation.Value *;
@org.springframework.stereotype.Service *;
@org.springframework.stereotype.Component *;
@org.springframework.scheduling.annotation.Scheduled *;
}
</option>
</options>
<libs>
<!-- Include main JAVA library required.-->
<lib>${java.home}/lib/rt.jar</lib>
<lib>${java.home}/lib/jce.jar</lib>
</libs>
</configuration>
<dependencies>
<dependency>
<groupId>net.sf.proguard</groupId>
<artifactId>proguard-base</artifactId>
<version>6.2.2</version>
</dependency>
</dependencies>
</plugin>
The problem's details are as follows:
[INFO] proguard jar: [D:\apache-maven-3.6.3\repository\net\sf\proguard\proguard-base\6.2.2\proguard-base-6.2.2.jar]
[proguard] ProGuard, version 7.2.2Exception in thread "main" java.lang.NoSuchMethodError: proguard.io.ClassReader.
[ERROR] Failed to execute goal com.github.wvengen:proguard-maven-plugin:2.6.0:proguard (default) on project com.center: Obfuscation failed (result=1) -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.github.wvengen:proguard-maven-plugin:2.6.0:proguard (default) on project com.center: Obfuscation failed (result=1) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289) at org.apache.maven.cli.MavenCli.main (MavenCli.java:193) at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:498) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347) Caused by: org.apache.maven.plugin.MojoExecutionException: Obfuscation failed (result=1) at com.github.wvengen.maven.proguard.ProGuardMojo.proguardMain (ProGuardMojo.java:1042) at com.github.wvengen.maven.proguard.ProGuardMojo.execute (ProGuardMojo.java:750) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289) at org.apache.maven.cli.MavenCli.main (MavenCli.java:193) at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:498) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Proguard version 6.2.2 is quite old. You could try the newer versions for that: https://mvnrepository.com/artifact/com.guardsquare/proguard-base https://mvnrepository.com/artifact/com.guardsquare/proguard-core
Proguard version 6.2.2 is quite old. You could try the newer versions for that: https://mvnrepository.com/artifact/com.guardsquare/proguard-base https://mvnrepository.com/artifact/com.guardsquare/proguard-core
Where can I find the Proguard version for java 1.8?Does the newner version work with java 1.8?
Proguard version 6.2.2 is quite old. You could try the newer versions for that: https://mvnrepository.com/artifact/com.guardsquare/proguard-base https://mvnrepository.com/artifact/com.guardsquare/proguard-core
Where can I find the Proguard version for java 1.8?Does the newner version work with java 1.8?
Not sure which versions of Java it supports, but I will not help with Java 8 issues anymore (Java 17 is the current main version and I do not use such old versions myself), so I will not look into that.