我们正在尝试对 Spring Boot 应用程序进行混淆。对于混淆,我们使用proguard
我做的配置是
<build>
<plugins>
<plugin>
<groupId>com.github.wvengen</groupId>
<artifactId>proguard-maven-plugin</artifactId>
<executions>
<execution>
<id>proguard</id>
<phase>package</phase>
<goals>
<goal>proguard</goal>
</goals>
</execution>
</executions>
<configuration>
<!-- File with proguard configuration -->
<proguardInclude>${basedir}/build/proguard.conf</proguardInclude>
<obfuscate>true</obfuscate>
<includeDependency>true</includeDependency>
<injar>${project.build.finalName}.${project.packaging}</injar>
<outjar>${project.build.finalName}-proguard.${project.packaging}</outjar>
</configuration>
<dependencies>
<dependency>
<groupId>net.sf.proguard</groupId>
<artifactId>proguard-base</artifactId>
<version>${version.net.sf.proguard}</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>com.Application</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
当我尝试构建应用程序时,它会在实际的战争文件中创建 METAINF.MF 文件,而不是在混淆的战争文件中。
在提供混淆和弹簧组装包之前,我还提供了maven-assembly-plugin插件。
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>assembly</id>
<goals>
<goal>single</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.Application</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<appendAssemblyId>false</appendAssemblyId>
<attach>false</attach>
</configuration>
</plugin>
谁能建议我需要提供的其他配置。
我尝试过重新排列插件的排列,但没有成功。
有没有办法在 Spring Boot Maven 插件中定义存档清单属性?