Spring boot 混淆Maven多模块Spring Boot项目

Spring boot 混淆Maven多模块Spring Boot项目,spring-boot,maven-3,proguard,obfuscation,multi-module,Spring Boot,Maven 3,Proguard,Obfuscation,Multi Module,我正在使用Java8运行一个springboot多模块maven项目。我需要使用proguard对进行模糊处理。我的要求只是混淆我的代码,保持一切原样。因此,我的项目如下所示: 模块B依赖于模块a。 模块C依赖于模块a和B两者。 模块D也依赖于模块a和B两者。 模块E不依赖于任何其他模块 组件输出模块C、模块D和模块E的JAR,这些JAR作为单独的弹簧靴应用程序运行。Module C和Module D的所有依赖项都进入lib目录,即Module C有一个lib文件夹,该文件夹将所有其他依赖项作

我正在使用
Java8
运行一个
springboot
多模块
maven
项目。我需要使用
proguard
进行模糊处理。我的要求只是混淆我的代码,保持一切原样。因此,我的项目如下所示:

模块B
依赖于
模块a
模块C
依赖于
模块a
B
两者。
模块D
也依赖于
模块a
B
两者。
模块E
不依赖于任何其他模块

组件
输出
模块C
模块D
模块E
的JAR,这些JAR作为单独的
弹簧靴
应用程序运行。
Module C
Module D
的所有依赖项都进入lib目录,即
Module C
有一个
lib
文件夹,该文件夹将所有其他依赖项作为一个jar,分别包含
Module a
Module B
的单独jar

因此,当我们提取模块C的Jar文件时,如下图所示:

因此,我需要对我的代码进行
模糊处理,以便开始使用
模块C
,因此我更新了
模块C
pom.xml

<proguard.version>6.2.2</proguard.version>
请建议,我如何用最小可能的更改混淆代码。如有任何建议,将不胜感激。提前谢谢

 <build>
        <plugins>
            <plugin>
                <groupId>com.github.wvengen</groupId>
                <artifactId>proguard-maven-plugin</artifactId>
                <version>${proguard.maven.plugin.version}</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>proguard</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <proguardVersion>${proguard.version}</proguardVersion>
                    <proguardInclude>proguard.conf</proguardInclude>
                    <putLibraryJarsInTempDir>true</putLibraryJarsInTempDir>
                    <libs>
                        <lib>${java.home}/lib/rt.jar</lib>
                    </libs>
                    <assembly>
                        <inclusions>
                            <inclusion>
                                <groupId>com.xyz</groupId>
                                <artifactId>module-a</artifactId>
                            </inclusion>
                            <inclusion>
                                <groupId>com.xyz</groupId>
                                <artifactId>module-b</artifactId>
                            </inclusion>
                        </inclusions>
                    </assembly>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>net.sf.proguard</groupId>
                        <artifactId>proguard-base</artifactId>
                        <version>${proguard.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>2.0.3.RELEASE</version>
                <configuration>
                    <executable>true</executable>
                    <layout>ZIP</layout>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
-libraryjars <java.home>/lib/rt.jar
    
-target 1.8 ##Specify the java version number
-dontshrink ##Default is enabled, here the shrink is turned off, that is, the unused classes/members are not deleted.
-dontoptimize ##Default is enabled, here to turn off bytecode level optimization
-useuniqueclassmembernames ## Take a unique strategy for confusing the naming of class members
-adaptclassstrings ## After confusing the class name, replace it with a place like Class.forName('className')
-dontnote
-ignorewarnings ## warnings are ignored
-dontwarn
-keep public class * extends org.springframework.boot.web.support.SpringBootServletInitializer
-keepdirectories ## Keep the package structure
-keepclasseswithmembers public class * { public static void main(java.lang.String[]);} ##Maintain the class of the main method and its method name
-keepclassmembers enum * { *; }  ##Reserving enumeration members and methods
-keepclassmembers class * {
     @org.springframework.beans.factory.annotation.Autowired *;
     @org.springframework.beans.factory.annotation.Qualifier *;
     @org.springframework.beans.factory.annotation.Value *;
     @org.springframework.beans.factory.annotation.Required *;
     @org.springframework.context.annotation.Bean *;
     @org.springframework.context.annotation.Primary *;
     @org.springframework.boot.context.properties.ConfigurationProperties *;
     @org.springframework.boot.context.properties.EnableConfigurationProperties *;
     @javax.inject.Inject *;
     @javax.annotation.PostConstruct *;
     @javax.annotation.PreDestroy *;
}

-keep class java.xml.bind.** { *; }
-keep @org.springframework.boot.autoconfigure.SpringBootApplication class org.openskye.**
-keep @org.springframework.context.annotation.Configuration class org.openskye.**
-keep @org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration class * 

-keep class microsoft.exchange.webservices.** { *; }
-keep @org.springframework.cache.annotation.EnableCaching class *
-keep @org.springframework.context.annotation.Configuration class *
-keep @org.springframework.boot.context.properties.ConfigurationProperties class *
-keep @org.springframework.boot.autoconfigure.SpringBootApplication class *
-keep @org.springframework.boot.autoconfigure.batch class *
-allowaccessmodification
-keepattributes Signature
-keepattributes *Annotation*
-keepattributes EnclosingMethod
-keepattributes InnerClasses
-keepattributes Annotation
-keepdirectories com.jayk.springboot.proguard.obfuscationdemo
-keepdirectories org.springframework.boot.autoconfigure
## Do not change names of the getters and setter, if you remove this ##thymeleaf unable to find the getter and setter i.e: ##${greetingDTO.message}
-keepclassmembers class * {
    *** get*();
    void set*(***);
}
-keepclassmembernames class * {
     java.lang.Class class$(java.lang.String);
     java.lang.Class class$(java.lang.String, boolean);
}
-keepclassmembers enum * {
     public static **[] values();
     public static ** valueOf(java.lang.String);
     public static ** fromValue(java.lang.String);
}
 -keepattributes RuntimeVisibleAnnotations
    -keep @javax.persistence.* class * {
       *;
}
-keepnames class * implements java.io.Serializable
-keepclassmembernames public class com.test.blah.config.liquibase.AsyncSpringLiquibase
-keepclassmembers class * implements java.io.Serializable {
     static final long serialVersionUID;
     private static final java.io.ObjectStreamField[] serialPersistentFields;
     !static !transient <fields>;
     !private <fields>;
     !private <methods>;
     private void writeObject(java.io.ObjectOutputStream);
     private void readObject(java.io.ObjectInputStream);
     java.lang.Object writeReplace();
     java.lang.Object readResolve();
}
-keepclassmembers class * {
     @org.springframework.beans.factory.annotation.Autowired *;
     @org.springframework.security.access.prepost.PreAuthorize <methods>;
}

 -keepclassmembers class * {
    @org.springframework.beans.factory.annotation.Value *;
    @org.springframework.context.annotation.Bean *;
    @org.springframework.transaction.annotation.Transactional *;
    }
   
Caused by: java.lang.IllegalStateException: Conflicting persistence unit definitions for name 'Default': file:/C:/Users/admin/Downloads/ABC-proguard_3.52.0/ABC-proguard_3.52.0/assembly/target/xyz-3.52.0-SNAPSHOT-bin/module-c/3.52.0-SNAPSHOT/module-c.jar, file:/C:/Users/admin/Downloads/ABC-proguard_3.52.0/ABC-proguard_3.52.0/assembly/target/xyz-3.52.0-SNAPSHOT-bin/module-c/3.52.0-SNAPSHOT/module-c.jar