我试图混淆带有依赖项的 jar(尽管如果我将常规单个 jar 设置为 inFile,同样的问题也会影响)。
我正在使用 Java 8,但我必须使用较新版本的 Proguard 和 Proguard Maven 插件,因为覆盖了来自更高版本的一些 jar 依赖项(否则我会遇到“不支持的主次版本”问题)。
当执行“mvn clean install”时,该步骤被执行,但我收到“在pluginArtifacts中找不到proguard jar错误”。请参阅下面的日志。
我在 Proguard Maven 插件代码中看到,现在您需要(从 7.0.0 开始)来自 com.guardsquare 的 proguard-base 和 proguard-core,而不是 net.sf.proguard 中过时的先前版本 - 这个不适合以后使用罐子。
显然,在我指定的地方找不到 proguard jar - 我应该如何包含此依赖项?
我在我的 pom 中使用这个:
<build>
<plugins>
<plugin>
<groupId>com.github.wvengen</groupId>
<artifactId>proguard-maven-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals><goal>proguard</goal></goals>
<configuration>
<injar>${project.build.finalName}-jar-with-dependencies.jar</injar>
<outjar>${project.build.finalName}-small.jar</outjar>
<proguardVersion>7.1.0</proguardVersion>
<options>
<option>-allowaccessmodification</option>
<option>-dontoptimize</option>
<option>-dontshrink</option>
<option>-dontnote</option>
<option>-dontwarn</option> <!-- added option to ignore com.sun missing classes -->
<option>-keepattributes Signature</option>
</options>
<libs>
<lib>${java.home}/lib/rt.jar</lib>
</libs>
<dependencies>
<dependency>
<groupId>com.guardsquare</groupId> …
Run Code Online (Sandbox Code Playgroud) 我正在构建一个桌面应用程序。我使用 ProGuard 并进行以下配置:
@proguard_jmods.cfg
#-dontshrink
-dontoptimize
#-dontobfuscate
-repackageclasses ''
-renamesourcefileattribute SourceFile
-keepattributes *Annotation*,Signature,Annotation,InnerClasses,EnclosingMethod,SourceFile,LineNumberTable
-adaptresourcefilenames
-dontnote
-dontwarn com.ctc.wstx.**,com.github.**,com.jolbox.bonecp.**,com.mchange.v2.**,com.sun.istack.**,com.sun.tools.**,com.healthmarketscience.**,com.healthmarketscience.**,org.codehaus.**,org.iq80.snappy.**,com.sun.xml.**,com.thoughtworks.xstream.**,de.l3s.boilerpipe.**,javax.activation.**,javax.transaction.**,net.sf.ehcache.**,opennlp.tools.util.**,org.apache.cxf.**,org.apache.log4j.**,org.apache.poi.**,org.apache.sis.**,org.apache.**,org.dom4j.**,org.codehaus.plexus.**,javax.enterprise.**,org.glassfish.**,org.jdesktop.**,org.quartz.**,com.sun.org.**,javax.imageio.metadata.**,javax.xml.**,javax.jws.**,org.w3c.dom.**,org.xml.sax.**,au.com.bytecode.**,com.fasterxml.jackson.**,com.google.common.**,com.google.gson.**,com.googlecode.mp4parser.**,com.itextpdf.**,com.mchange.v1.**,com.microsoft.schemas.**,com.strobel.assembler.**,com.strobel.compilerservices.**,examples.RCallerScriptEngineExample1.**,examples.RCallerScriptEngineExample2.**,examples.RCallerScriptEngineExample2.**,examples.RCallerScriptEngineExample3.**,javassist.util.HotSwapAgent.**,javassist.util.HotSwapper.**,javax.rmi.CORBA.**,javax.rmi.CORBA.**,javax.rmi.PortableRemoteObject.**,org.bouncycastle.**,org.cyberneko.**,org.eclipse.jetty.**,org.etsi.uri.**,org.jboss.com.**,org.jdom2.**,org.jfree.**,org.joda.time.**,org.terracotta.quartz.**,ucar.nc2.grib.**,javax.imageio.metadata.**,com.jmatio.io.**,javax.script.**,com.sun.**,java.rmi.**,opennlp.tools.sentiment.**,java.lang.**,java.util.**,sun.misc.Unsafe.**,sun.**,org.w3.**,net.sf.ehcache.distribution.**,org.apache.http.**,org.apache.any23.**,com.graphbuilder.curve.**,com.strobel.decompiler.**,com.uwyn.jhighlight.**,rg.codehaus.stax2.**,org.openxmlformats.schemas.**,org.springframework.**,org.slf4j.**,com.mysql.**,org.pushingpixels.**,org.hibernate.**,org.jboss.**,net.bytebuddy.**,javax.persistence.**,org.eclipse.**,java.awt.datatransfer.**,java.sql.**,org.objectweb.**,org.apache.any23.**
-ignorewarnings
-verbose
-printseeds seed
# Keep - Applications. Keep all application classes, along with their 'main' methods.
-keepclasseswithmembers public class * {
public static void main(java.lang.String[]);
}
-keep interface *
-keepnames class ** implements com.xxx.xx.utils.ISerialisable
-keepclassmembers class ** implements com.xxx.xx.utils.ISerialisable {
<fields>;
}
-keep,allowshrinking class ** extends com.xxx.xx.utils.ISerialisable
# Keep - Applications. Keep all application classes, along with their 'main' methods.
-keepclasseswithmembers public …
Run Code Online (Sandbox Code Playgroud)