<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.shcd</groupId> <artifactId>licence</artifactId> <packaging>pom</packaging> <version>1.0.0.RELEASE</version> <description>licence许可证书</description> <modules> <module>server</module> <module>core</module> <module>client-offline</module> </modules> <properties> <maven.compiler.source>8</maven.compiler.source> <maven.compiler.target>8</maven.compiler.target> </properties> <!-- SpringBoot 版本 --> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.5.15</version> </parent> <dependencies> <!-- web支持 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> </dependencies> <!-- 构建工具 --> <build> <plugins> <!-- 打包插件 --> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <includeSystemScope>true</includeSystemScope> </configuration> </plugin> <plugin> <!-- 1. 加密后,方法体被清空,保留方法参数、注解等信息.主要兼容swagger文档注解扫描 2. 方法体被清空后,反编译只能看到方法名和注解,看不到方法体的具体内容 3. 加密后的项目需要设置javaagent来启动,启动过程中解密class,完全内存解密,不留下任何解密后的文件 4. 启动加密后的jar,生成xxx-encrypted.jar,这个就是加密后的jar文件,加密后不可直接执行 5. 无密码启动方式,java -javaagent:xxx-encrypted.jar -jar xxx-encrypted.jar 6. 有密码启动方式,java -javaagent:xxx-encrypted.jar='-pwd= 密码' -jar xxx-encrypted.jar --> <groupId>net.roseboy</groupId> <artifactId>classfinal-maven-plugin</artifactId> <version>1.2.1</version> <configuration> <password>#</password><!-- #表示启动时不需要密码,事实上对于代码混淆来说,这个密码没什么用,它只是一个启动密码 --> <excludes>org.spring</excludes> <packages>${groupId}</packages><!-- 加密的包名,多个包用逗号分开 --> <cfgfiles>application.yml,application-dev.yml</cfgfiles><!-- 加密的配置文件,多个包用逗号分开 --> <libjars>core-licence-1.0.0.RELEASE.jar</libjars> <!-- jar包lib下面要加密的jar依赖文件,多个包用逗号分开 --> </configuration> <executions> <execution> <phase>package</phase> <goals> <goal>classFinal</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </project>