首页 > 解决方案 > Proguard 不在正确的目录中生成类

问题描述

我正在使用 Proguard 优化.war文件,但它不起作用。我遇到的问题之一是它没有生成它应该生成的类。

在这里,可以看到主类____EntryPoint并没有放在____embedded目录下,而是放在了classes.____embedded,但是程序运行的时候在里面找这个类____embedded,所以失败了。

在此处输入图像描述

这只是我面临的问题之一,因为它显示了许多警告:

Warning: library class javax.sql.XAConnection depends on program class javax.transaction.xa.XAResource
Note: there were 13 classes trying to access generic signatures using reflection.
      You should consider keeping the signature attributes
      (using '-keepattributes Signature').
      (https://www.guardsquare.com/proguard/manual/troubleshooting#attributes)
Note: there were 3 classes trying to access enclosing classes using reflection.
      You should consider keeping the inner classes attributes
      (using '-keepattributes InnerClasses').
      (https://www.guardsquare.com/proguard/manual/troubleshooting#attributes)
Note: there were 15 unresolved dynamic references to classes or interfaces.
      You should check if you need to specify additional program jars.
      (https://www.guardsquare.com/proguard/manual/troubleshooting#dynamicalclass)
Note: there were 3 class casts of dynamically created class instances.
      You might consider explicitly keeping the mentioned classes and/or
      their implementations (using '-keep').
      (https://www.guardsquare.com/proguard/manual/troubleshooting#dynamicalclasscast)
Note: there were 34 accesses to class members by means of reflection.
      You should consider explicitly keeping the mentioned class members
      (using '-keep' or '-keepclassmembers').
      (https://www.guardsquare.com/proguard/manual/troubleshooting#dynamicalclassmember)
Warning: there were 787 unresolved references to classes or interfaces.
         You may need to add missing library jars or update their versions.
         If your code works fine without the missing classes, you can suppress
         the warnings with '-dontwarn' options.
         (https://www.guardsquare.com/proguard/manual/troubleshooting#unresolvedclass)
Warning: there were 1 instances of library classes depending on program classes.
         You must avoid such dependencies, since the program classes will
         be processed, while the library classes will remain unchanged.
         (https://www.guardsquare.com/proguard/manual/troubleshooting#dependency)
Warning: there were 3 unresolved references to program class members.
         Your input classes appear to be inconsistent.
         You may need to recompile the code.
         (https://www.guardsquare.com/proguard/manual/troubleshooting#unresolvedprogramclassmember)
Note: you're ignoring all warnings!

似乎在清单上指定了主类:

Manifest-Version: 1.0
Created-By: 1.7.0_03 (Oracle Corporation)
Main-Class: ____embedded.____EntryPoint

也许如果它要改变放置类的地方,清单应该更新。

我的配置文件:

-injars       apex.war
-outjars      apex_out.war
-ignorewarnings
-keepattributes *Annotation*

-libraryjars <java.home>/lib/

-keep public class ____embedded.____EntryPoint {
   public static void main(java.lang.String[]);
}

-keep,includedescriptorclasses public class ____bootstrap.____Bootstrap {
   <methods>;
}

标签: javaproguard

解决方案


推荐阅读