- 实现了 `SpringBootJarSlimEncryptApplication` 用于处理使用 XJar 加密的 JAR 文件,并支持基于 XML 的包含/排除配置。 - 新增 Maven `pom.xml` 文件为新模块并设置必要的依赖(XJar、Dom4j、Hutool)。 - 引入了 `PlainTextClassLoader` 用于外部 JAR 文件的动态类加载。 - 修改根目录下的 `pom.xml` 文件以包含新的模块(`spring-boot-jar-slim-encrypt`、`thin-launcher-demo`、`spring-boot-custom-classloader`)。 - 添加了诸如 `JarUtil` 等工具类,用于处理 JAR 文件的操作和加密。
109 lines
4.4 KiB
XML
109 lines
4.4 KiB
XML
<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>
|
||
<parent>
|
||
<groupId>com.mangmang</groupId>
|
||
<artifactId>learning-nexus</artifactId>
|
||
<version>1.0.0</version>
|
||
</parent>
|
||
|
||
<artifactId>spring-boot-jar-slim-encrypt</artifactId>
|
||
<packaging>jar</packaging>
|
||
|
||
<name>spring-boot-jar-slim-encrypt</name>
|
||
<url>http://maven.apache.org</url>
|
||
|
||
<properties>
|
||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||
</properties>
|
||
|
||
<!-- 设置 jitpack.io 仓库 -->
|
||
<repositories>
|
||
<repository>
|
||
<id>jitpack.io</id>
|
||
<url>https://jitpack.io</url>
|
||
</repository>
|
||
</repositories>
|
||
|
||
<!-- 添加 XJar 依赖 -->
|
||
<dependencies>
|
||
<dependency>
|
||
<groupId>com.github.core-lib</groupId>
|
||
<artifactId>xjar</artifactId>
|
||
<version>4.0.0</version>
|
||
</dependency>
|
||
<dependency>
|
||
<groupId>org.dom4j</groupId>
|
||
<artifactId>dom4j</artifactId>
|
||
<version>2.1.4</version>
|
||
</dependency>
|
||
<dependency>
|
||
<groupId>cn.hutool</groupId>
|
||
<artifactId>hutool-core</artifactId>
|
||
<version>5.8.25</version>
|
||
</dependency>
|
||
<dependency>
|
||
<groupId>org.apache.commons</groupId>
|
||
<artifactId>commons-lang3</artifactId>
|
||
<version>3.0</version>
|
||
</dependency>
|
||
</dependencies>
|
||
|
||
|
||
<build>
|
||
<plugins>
|
||
<!-- 插件 1: maven-jar-plugin -->
|
||
<!-- 用于构建标准的 JAR 文件(仅包含项目编译输出,不含依赖) -->
|
||
<plugin>
|
||
<groupId>org.apache.maven.plugins</groupId>
|
||
<artifactId>maven-jar-plugin</artifactId>
|
||
<version>3.2.0</version>
|
||
<configuration>
|
||
<!-- 配置 JAR 包的归档文件 -->
|
||
<archive>
|
||
<manifest>
|
||
<!-- 指定可执行 JAR 的主类(含 main 方法的类) -->
|
||
<!-- 作用:使生成的 JAR 可通过 java -jar 直接运行 -->
|
||
<mainClass>com.mangmang.SpringBootJarSlimEncryptApplication</mainClass>
|
||
</manifest>
|
||
</archive>
|
||
</configuration>
|
||
</plugin>
|
||
|
||
<!-- 插件 2: maven-assembly-plugin -->
|
||
<!-- 用于构建包含所有依赖的 "fat jar"(即 "uber jar"),适合独立运行 -->
|
||
<!-- 生成的 JAR 名称通常会附加 "-jar-with-dependencies" 后缀 -->
|
||
<plugin>
|
||
<groupId>org.apache.maven.plugins</groupId>
|
||
<artifactId>maven-assembly-plugin</artifactId>
|
||
<version>3.3.0</version>
|
||
<executions>
|
||
<execution>
|
||
<id>make-assembly</id>
|
||
<!-- 绑定到 Maven 生命周期的 "package" 阶段 -->
|
||
<!-- 即执行 mvn package 时会触发此插件 -->
|
||
<phase>package</phase>
|
||
<goals>
|
||
<!-- 执行目标:single 表示生成单个 JAR 文件 -->
|
||
<goal>single</goal>
|
||
</goals>
|
||
<configuration>
|
||
<!-- 使用预定义描述符 "jar-with-dependencies" -->
|
||
<!-- 作用:包含项目所有依赖(包括本地依赖和第三方库) -->
|
||
<descriptorRefs>
|
||
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||
</descriptorRefs>
|
||
<archive>
|
||
<manifest>
|
||
<!-- 同样指定主类,确保 fat jar 可直接运行 -->
|
||
<mainClass>com.mangmang.SpringBootJarSlimEncryptApplication</mainClass>
|
||
</manifest>
|
||
</archive>
|
||
</configuration>
|
||
</execution>
|
||
</executions>
|
||
</plugin>
|
||
</plugins>
|
||
</build>
|
||
</project>
|