War proguard不包含项目的jar文件

时间:2018-04-04 07:31:41

标签: proguard war obfuscation

我试图混淆一个战争项目。我知道当你对一个war项目进行模糊处理时,你可以在WEB-INF/lib中找到一个项目的jar文件,几个月前,当我对我的项目进行模糊处理时,我可以找到这个jar文件。但是当我现在对它进行模糊处理时,我找不到jar文件,因此该项目不会在tomcat上部署。

有什么想法吗?

这是我的proguard配置文件:

-injars /target/project-1.0.0-BUILD-SNAPSHOT
-outjars /target/project.war
-dontwarn
-optimizations !class/marking/final
-adaptresourcefilecontents **.properties,META-INF/MANIFEST.MF,META-INF/spring.*,spring/*
-keepattributes Exceptions,InnerClasses,Signature,Deprecated,SourceFile,LineNumberTable,*Annotation*,EnclosingMethod 
-allowaccessmodification
-dontshrink
-dontoptimize
-dontnote
-dontusemixedcaseclassnames
-keepdirectories

   -keep class org.springframework.** { *; }
   -keep @javax.annotation.Resource class *
   -keep @org.springframework.cache.annotation.EnableCaching class *
   -keep public class * implements javax.servlet.Servlet
   -keep class com.zaxxer.hikari.** {*;}
   -keep class  javax.el.Expression {*;}
   -keep class javax.** { *; }
   -keep class javax.validation.** {*;}
   -keep class java.** { *; }
   -keep class org.primefaces.** {*;}
   -keep class org.** { *; }
   -keep class javassist.** { *; }
   -keep class cglib.** {*;}
   -keep class io.jsonwebtoken.** {*;}
   -keep class io.swagger.** {*;}
   -keep class com.fasterxml.** {*;}
   -keep class com.sun.** {*;}
   -keep class dom4j.** {*;}
   -keep class antlr.** {*;}
   -keep class mysql.mysql-connector-java.** {*;}
   -keep class com.mysql.jdbc.** {*;}
   -keep class com.mysql.cj.core.** {*;}
   -keep class com.mysql.cj.api.** {*;}
   -keep class com.mysql.cj.jdbc.** {*;}
   -keep class com.mysql.cj.mysqla.** {*;}
   -keep class com.mysql.cj.mysqlx.protobuf.MysqlxDatatypes$Any {*;}
   -keep public class com.mysql.cj.mysqlx.** {*;}
   -keep class * implements java.sql.Driver 
   -keep class com.ctc.wstx.stax.WstxEventFactory {*;}
   -keep class com.google.protobuf.CodedInputStream {*;}
   -keep class com.google.protobuf.ExtensionRegistryLite {*;}
   -keep class com.google.protobuf.DynamicMessage {*;}
   -keep class com.google.protobuf.MysqlxDatatypes$Object$Builder {*;}
   -keep class com.google.protobuf.MysqlxDatatypes$Array$Builder {*;}
   -keep class edu.vt.middleware.vt-password.** {*;}
   -keep class junit.junit.** {*;}
   -keep class io.netty.netty-all.** {*;}
   -keep class commons-dbcp.commons-dbcp.** {*;}
   -keep class org.apache.poi.poi.** {*;}
   -keep class com.google.code.gson.gson.** {*;}
   -keep class com.fasterxml.jackson.core.** {*;}
   -keep class com.sun.faces.** {*;}
   -keep class org.glassfish.web.el-impl.** {*;}
   -keep class postgresql.postgresql.** {*;}
   -keep class net.sf.jt400.jt400-full.** {*;}
   -keep class c3p0.c3p0.** {*;}
   -keep class com.lowagie.itext.** {*;}
   -keep class org.apache.xmlbeans.xmlbeans.** {*;}
   -keep class ojdbc.ojdbc.** {*;}
   -keep class oracle.jdbc.driver.** {*;}
   -keep class oracle.** {*;}
   -keep class edu.vt.middleware.** {*;}
   -keep class javax.faces.view.** {*;}
   -keep class org.omnifaces.omnifaces.** {*;}



    -keepclassmembers class * {
    @org.springframework.beans.factory.annotation.* *;
    @org.springframework.beans.factory.annotation.Qualifier *;
    @org.springframework.beans.factory.annotation.Value *;
    @org.springframework.beans.factory.annotation.Required *;
    @org.springframework.context.annotation.Bean *;
    @javax.annotation.PostConstruct *;
    @javax.annotation.PreDestroy *;
    @org.aspectj.lang.annotation.AfterReturning *;
    @org.aspectj.lang.annotation.Pointcut *;
    @org.aspectj.lang.annotation.AfterThrowing *;
    @org.aspectj.lang.annotation.Around *;
    @org.apache.cxf.jaxrs.validation.JAXRSBeanValidationInInterceptor *;
}



# Preserve the special static methods that are required in all enumeration
# classes.

-keepclassmembers class * extends java.lang.Enum {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

# Explicitly preserve all serialization members. The Serializable interface
# is only a marker interface, so it wouldn't save them.
# You can comment this out if your library doesn't use serialization.
# If your code contains serializable classes that have to be backward
# compatible, please refer to the manual.

-keepnames class * implements java.io.Serializable

-keepclassmembers class * implements java.io.Serializable {
    static final long serialVersionUID;
    private static final java.io.ObjectStreamField[] serialPersistentFields;
    !static !transient <fields>;
    private void writeObject(java.io.ObjectOutputStream);
    private void readObject(java.io.ObjectInputStream);
    java.lang.Object writeReplace();
    java.lang.Object readResolve();
}

-keepclassmembers class * {
    @javax.annotation.Resource *;
}

-keepclassmembers class * {
 @javax.persistence.Id <fields>;
}
-keepattributes RuntimeVisibleAnnotations
-keep @javax.persistence.* class * {
    *;
}

 -keep @org.springframework.stereotype.Service class *
 -keep @org.springframework.stereotype.Component class *
 -keep @org.springframework.stereotype.Controller class *
 -keep @com.scsoft.afc.utility.scope.SpringViewScoped class *

 -keep,allowobfuscation class com.test.** {*;}
   -keep class com.test.service.** {
     *;
  }

以下是<build>的{​​{1}}部分:

pom.xml

1 个答案:

答案 0 :(得分:0)

问题是我在使用attachClasses时正在使用archiveClasses。现在一切都像魅力一样。