gpt4 book ai didi

proguard.conf option -keep and -dontwarn not work(ProGud.conf选项-Keep和-dontwarn不起作用)

转载 作者:bug小助手 更新时间:2023-10-25 19:37:58 25 4
gpt4 key购买 nike



I'm building a regular uber-jar (not native executable file) based on Quarkus. and I also wanna obfuscate the uber-jar. so I build the jar file with

我正在构建一个基于Quarkus的常规uber-jar(非本地可执行文件)。我还想把超级广播罐弄糊涂。所以我用以下命令构建JAR文件


 ./gradlew quarkusBuild -Dquarkus.package.type=uber-jar


and here is part of build.gradle.kts

这是Build.gradle.kts的一部分


 tasks.register("proguard", JavaExec::class) {
classpath = files("$rootDir/proguard/lib/proguard.jar")
main = "proguard.ProGuard"
args(
"-include",
"proguard.conf",
"-injars",
"build/my-project-1.0.0-runner.jar",
"-outjars",
"build/app.jar"
)
}


howerver, after I build the jar and run ./gradlew proguard, I got tons of warnings,

然而,在我造好罐子跑了之后,我收到了大量的警告,


Warning: there were 3260 unresolved references to classes or interfaces.

Warning: there were 56 unresolved references to program class members.

Warning: there were 204 unresolved references to library class members.


Thounds of warnings !! I think maybe I should use option -keep to prevent some package from obfuscating.but there are too many warnings and I wonder is it the right way to fix the warning. anyway I add some -keep option in proguard.conf, and it is interesting that I find some option not work. here is my proguard.conf:

警告声四起!!我想也许我应该使用Option-Keep来防止一些包混淆。但是警告太多了,我想知道这是不是解决警告的正确方法。无论如何,我在proward.conf中添加了一些-Keep选项,有趣的是,我发现一些选项不起作用。下面是我的proGuard.conf:


-target 17
# -verbose

-dontshrink

-dontoptimize

-dontwarn

-adaptclassstrings

-libraryjars /usr/lib/jvm/temurin-17-jdk-amd64/jmods/java.base.jmod
-libraryjars /usr/lib/jvm/temurin-17-jdk-amd64/jmods/java.logging.jmod
-libraryjars /usr/lib/jvm/temurin-17-jdk-amd64/jmods/java.sql.jmod
-libraryjars /usr/lib/jvm/temurin-17-jdk-amd64/jmods/java.xml.jmod




# Keep all Quarkus-related classes and resources
-keep class io.quarkus.** { *; }
-keep class io.quarkus.vertx.** { *; }
-keep interface io.quarkus.vertx.** { *; }
-keep class io.vertx.** { *; }
-keep class io.vertx.**
-keep class io.vertx.** {
*;
}

-keep interface io.vertx.** { *; }
-keep interface com.sun.** { *; }
-keep interface io.quarkus.** { *; }
-keep class javax.** { *; }
-keep class com.google.common.** { *; }
-keep class com.sun.** { *; }
-keep class java.util.logging.Level { *; }
-keep class com.fasterxml.jackson.annotation.** { *; }
-dontwarn com.fasterxml.jackson.databind
-dontwarn javax.annotation.**
-dontwarn javax.xml.**
-dontwarn javax.**
-dontwarn java.awt.**
-keep class javax.annotation.** { *; }
-keep class org.apache.log4j.** { *; }
-keep class org.apache.log4j.**
-keep class org.jboss.** { *; }
-keep class org.jboss.**
-keep class io.netty.** { *; }
-keep class io.netty.**
-keep class sun.misc.** { *; }
-keep class sun.misc.**

-keepattributes *Annotation*,Signature

# Keep application-specific classes and resources
-keep class org.myproject.** { *; }


As you can see , I've add -keep class io.netty.** { *; } -keep class io.netty.** but still got io.netty warning:

如您所见,我添加了-保留io.netty类。**{*;}-保留了io.netty类。**但仍收到io.netty警告:


// part of the massive warning

Warning: io.netty.handler.ssl.OpenSsl: can't find referenced class io.netty.internal.tcnative.SSL
Warning: io.netty.handler.ssl.OpenSsl: can't find referenced class io.netty.internal.tcnative.SSLContext

// ...
// also, I've add -keep org.jboss.**
Warning: io.netty.handler.codec.marshalling.LimitingByteInput: can't find referenced class org.jboss.marshalling.ByteInput

// and some similar occasion, I've add the keep option but still get warning
Warning: com.google.common.util.concurrent.AbstractFuture$UnsafeAtomicHelper: can't find referenced class sun.misc.Unsafe


// I've add java.base.jmod and java.logging.jmod, java.sql.jmod and java.xml.jmod
// now I have to add java.beans.jmod ? I have to add all the jmod in the jdk?
Warning: com.fasterxml.jackson.databind.ext.Java7SupportImpl: can't find referenced class java.beans.Transient
Warning: com.fasterxml.jackson.databind.ext.Java7SupportImpl: can't find referenced class java.beans.ConstructorProperties
Warning: com.fasterxml.jackson.databind.ext.Java7SupportImpl: can't find referenced class java.beans.Transient




maybe you've notice that I have even add -dontwarn but why I still got the thounds warnings .

也许你已经注意到,我甚至有附加警告,但为什么我仍然得到了响亮的警告。


更多回答
优秀答案推荐
更多回答

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com