2025-09-26 00:29:15 +08:00
|
|
|
|
<?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.light</groupId>
|
|
|
|
|
<artifactId>light-delivery</artifactId>
|
|
|
|
|
<version>1.0.0</version>
|
|
|
|
|
<packaging>jar</packaging>
|
|
|
|
|
|
|
|
|
|
<name>Light Delivery Backend</name>
|
|
|
|
|
<description>Backend for Light Delivery Mini Program</description>
|
|
|
|
|
|
|
|
|
|
<!-- 使用 Spring Boot 3.1.4 作为父项目,统一管理依赖版本 -->
|
|
|
|
|
<parent>
|
|
|
|
|
<groupId>org.springframework.boot</groupId>
|
|
|
|
|
<artifactId>spring-boot-starter-parent</artifactId>
|
|
|
|
|
<version>3.1.4</version>
|
|
|
|
|
<relativePath/> <!-- lookup parent from repository -->
|
|
|
|
|
</parent>
|
|
|
|
|
|
|
|
|
|
<properties>
|
|
|
|
|
<!-- 定义 Java 17 版本,Spring Boot 3.x 要求 JDK 17 及以上 -->
|
|
|
|
|
<java.version>17</java.version>
|
|
|
|
|
<lombok.version>1.18.38</lombok.version>
|
|
|
|
|
<mysql.version>8.0.33</mysql.version>
|
|
|
|
|
<!-- Docker镜像相关属性 -->
|
|
|
|
|
<docker.image.prefix>light</docker.image.prefix>
|
|
|
|
|
<!-- Jib 插件版本 -->
|
|
|
|
|
<jib-maven-plugin.version>3.3.1</jib-maven-plugin.version>
|
|
|
|
|
</properties>
|
|
|
|
|
|
|
|
|
|
<dependencyManagement>
|
|
|
|
|
<dependencies>
|
|
|
|
|
<!-- 导入 Spring Modulith BOM 以统一管理其依赖版本 -->
|
|
|
|
|
<!-- <dependency>
|
|
|
|
|
<groupId>org.springframework.modulith</groupId>
|
|
|
|
|
<artifactId>spring-modulith-bom</artifactId>
|
|
|
|
|
<version>${spring-modulith.version}</version>
|
|
|
|
|
<type>pom</type>
|
|
|
|
|
<scope>import</scope>
|
|
|
|
|
</dependency> -->
|
|
|
|
|
<!-- 如果需要指定其他第三方依赖版本,也可在此处添加 -->
|
|
|
|
|
</dependencies>
|
|
|
|
|
</dependencyManagement>
|
|
|
|
|
|
|
|
|
|
<dependencies>
|
|
|
|
|
<!-- ========== Spring Boot Starters (Web & Data) ========== -->
|
|
|
|
|
<dependency>
|
|
|
|
|
<groupId>org.springframework.boot</groupId>
|
|
|
|
|
<artifactId>spring-boot-starter-web</artifactId>
|
|
|
|
|
</dependency>
|
|
|
|
|
|
|
|
|
|
<dependency>
|
|
|
|
|
<groupId>org.springframework.boot</groupId>
|
|
|
|
|
<artifactId>spring-boot-starter-json</artifactId> <!-- Web starter 通常已包含,检查是否必要 -->
|
|
|
|
|
</dependency>
|
|
|
|
|
|
|
|
|
|
<dependency>
|
|
|
|
|
<groupId>org.springframework.boot</groupId>
|
|
|
|
|
<artifactId>spring-boot-starter-websocket</artifactId>
|
|
|
|
|
</dependency>
|
|
|
|
|
|
|
|
|
|
<dependency>
|
|
|
|
|
<groupId>org.springframework.boot</groupId>
|
|
|
|
|
<artifactId>spring-boot-starter-data-jpa</artifactId> <!-- 版本由父POM管理,移除显式版本 -->
|
|
|
|
|
</dependency>
|
|
|
|
|
|
|
|
|
|
<dependency>
|
|
|
|
|
<groupId>org.springframework.boot</groupId>
|
|
|
|
|
<artifactId>spring-boot-starter-data-redis</artifactId>
|
|
|
|
|
</dependency>
|
|
|
|
|
|
|
|
|
|
<dependency>
|
|
|
|
|
<groupId>org.projectlombok</groupId>
|
|
|
|
|
<artifactId>lombok</artifactId>
|
|
|
|
|
<version>1.18.38</version>
|
|
|
|
|
</dependency>
|
|
|
|
|
|
|
|
|
|
<!-- JJWT (确保版本与 Spring Boot 3 和 Java 17 兼容) -->
|
|
|
|
|
<dependency>
|
|
|
|
|
<groupId>io.jsonwebtoken</groupId>
|
|
|
|
|
<artifactId>jjwt-api</artifactId>
|
|
|
|
|
<version>0.11.5</version> <!-- 使用较新的 API 版本 -->
|
|
|
|
|
</dependency>
|
|
|
|
|
<dependency>
|
|
|
|
|
<groupId>io.jsonwebtoken</groupId>
|
|
|
|
|
<artifactId>jjwt-impl</artifactId>
|
|
|
|
|
<version>0.11.5</version>
|
|
|
|
|
<scope>runtime</scope>
|
|
|
|
|
</dependency>
|
|
|
|
|
<dependency>
|
|
|
|
|
<groupId>io.jsonwebtoken</groupId>
|
|
|
|
|
<artifactId>jjwt-jackson</artifactId> <!-- 或 jjwt-gson -->
|
|
|
|
|
<version>0.11.5</version>
|
|
|
|
|
<scope>runtime</scope>
|
|
|
|
|
</dependency>
|
|
|
|
|
|
|
|
|
|
<!-- 添加 Tomcat embed core 以支持 HTTPS 重定向配置 -->
|
|
|
|
|
<dependency>
|
|
|
|
|
<groupId>org.apache.tomcat.embed</groupId>
|
|
|
|
|
<artifactId>tomcat-embed-core</artifactId>
|
|
|
|
|
</dependency>
|
|
|
|
|
|
|
|
|
|
<!-- ========== Database ========== -->
|
|
|
|
|
<dependency>
|
|
|
|
|
<groupId>com.mysql</groupId>
|
|
|
|
|
<artifactId>mysql-connector-j</artifactId>
|
|
|
|
|
<scope>runtime</scope>
|
|
|
|
|
</dependency>
|
|
|
|
|
|
|
|
|
|
<!-- ========== Development ========== -->
|
|
|
|
|
<dependency>
|
|
|
|
|
<groupId>org.springframework.boot</groupId>
|
|
|
|
|
<artifactId>spring-boot-devtools</artifactId>
|
|
|
|
|
<scope>runtime</scope>
|
|
|
|
|
<optional>true</optional>
|
|
|
|
|
</dependency>
|
|
|
|
|
|
|
|
|
|
<!-- ========== Test Dependencies ========== -->
|
|
|
|
|
<dependency>
|
|
|
|
|
<groupId>org.springframework.boot</groupId>
|
|
|
|
|
<artifactId>spring-boot-starter-test</artifactId>
|
|
|
|
|
<scope>test</scope>
|
|
|
|
|
</dependency>
|
|
|
|
|
</dependencies>
|
|
|
|
|
|
|
|
|
|
<build>
|
|
|
|
|
<plugins>
|
|
|
|
|
<plugin>
|
|
|
|
|
<groupId>org.springframework.boot</groupId>
|
|
|
|
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
|
|
|
|
<configuration>
|
|
|
|
|
<excludes>
|
|
|
|
|
<exclude>
|
|
|
|
|
<groupId>org.projectlombok</groupId>
|
|
|
|
|
<artifactId>lombok</artifactId>
|
|
|
|
|
</exclude>
|
|
|
|
|
</excludes>
|
|
|
|
|
</configuration>
|
|
|
|
|
</plugin>
|
|
|
|
|
<!-- 可选:添加 Maven Compiler Plugin 明确指定 Java 版本 -->
|
|
|
|
|
<plugin>
|
|
|
|
|
<groupId>org.apache.maven.plugins</groupId>
|
|
|
|
|
<artifactId>maven-compiler-plugin</artifactId>
|
|
|
|
|
<version>3.11.0</version>
|
|
|
|
|
<configuration>
|
|
|
|
|
<source>${java.version}</source>
|
|
|
|
|
<target>${java.version}</target>
|
|
|
|
|
<encoding>UTF-8</encoding>
|
|
|
|
|
<!-- Use forked compilation to avoid annotation processor classloader issues -->
|
|
|
|
|
<fork>true</fork>
|
|
|
|
|
<annotationProcessorPaths>
|
|
|
|
|
<path>
|
|
|
|
|
<groupId>org.projectlombok</groupId>
|
|
|
|
|
<artifactId>lombok</artifactId>
|
|
|
|
|
<version>1.18.38</version> <!-- 请确保此处版本与你项目中的Lombok依赖版本一致 -->
|
|
|
|
|
</path>
|
|
|
|
|
<!-- 如果你项目中有其他注解处理器,也需要在这里显式添加 -->
|
|
|
|
|
</annotationProcessorPaths>
|
|
|
|
|
</configuration>
|
|
|
|
|
</plugin>
|
|
|
|
|
|
|
|
|
|
<!-- Jib Docker Plugin -->
|
|
|
|
|
<plugin>
|
|
|
|
|
<groupId>com.google.cloud.tools</groupId>
|
|
|
|
|
<artifactId>jib-maven-plugin</artifactId>
|
2025-09-28 03:16:09 +08:00
|
|
|
|
<version>3.4.2</version>
|
2025-09-26 00:29:15 +08:00
|
|
|
|
<configuration>
|
|
|
|
|
<from>
|
2025-09-28 03:11:25 +08:00
|
|
|
|
<!-- 明确指定使用本地 Docker 守护进程 -->
|
|
|
|
|
<image>docker://openjdk:17-jdk-slim</image>
|
2025-09-26 00:29:15 +08:00
|
|
|
|
</from>
|
|
|
|
|
<to>
|
2025-09-26 20:50:11 +08:00
|
|
|
|
<image>light-delivery-app</image>
|
2025-09-26 00:29:15 +08:00
|
|
|
|
<tags>
|
|
|
|
|
<tag>latest</tag>
|
|
|
|
|
<tag>${project.version}</tag>
|
|
|
|
|
</tags>
|
|
|
|
|
</to>
|
|
|
|
|
<container>
|
|
|
|
|
<ports>
|
|
|
|
|
<port>8080</port>
|
2025-09-26 20:50:11 +08:00
|
|
|
|
<port>8443</port>
|
2025-09-26 00:29:15 +08:00
|
|
|
|
</ports>
|
2025-09-26 20:50:11 +08:00
|
|
|
|
<environment>
|
|
|
|
|
<SPRING_PROFILES_ACTIVE>prod</SPRING_PROFILES_ACTIVE>
|
|
|
|
|
</environment>
|
2025-09-26 00:29:15 +08:00
|
|
|
|
<creationTime>USE_CURRENT_TIMESTAMP</creationTime>
|
2025-09-28 03:11:25 +08:00
|
|
|
|
<!-- 添加主类配置 -->
|
2025-09-26 20:50:11 +08:00
|
|
|
|
<mainClass>com.light.delivery.LightApplication</mainClass>
|
2025-09-26 00:29:15 +08:00
|
|
|
|
</container>
|
2025-09-28 03:11:25 +08:00
|
|
|
|
<!-- 强化离线配置 -->
|
2025-09-28 02:45:17 +08:00
|
|
|
|
<offline>true</offline>
|
2025-09-28 03:11:25 +08:00
|
|
|
|
<!-- 不验证远程仓库 -->
|
2025-09-28 02:45:17 +08:00
|
|
|
|
<allowInsecureRegistries>true</allowInsecureRegistries>
|
2025-09-28 03:11:25 +08:00
|
|
|
|
<!-- 不拉取父镜像 -->
|
|
|
|
|
<pullParent>false</pullParent>
|
|
|
|
|
<!-- 镜像标签配置 -->
|
|
|
|
|
<outputPaths>
|
|
|
|
|
<tar>${project.build.directory}/jib-image.tar</tar>
|
|
|
|
|
</outputPaths>
|
|
|
|
|
<!-- 优化CI/CD构建 -->
|
|
|
|
|
<containerizingMode>packaged</containerizingMode>
|
|
|
|
|
<!-- 其他优化配置 -->
|
|
|
|
|
<skip>false</skip>
|
|
|
|
|
<useOnlyProjectProperties>true</useOnlyProjectProperties>
|
2025-09-26 00:29:15 +08:00
|
|
|
|
</configuration>
|
|
|
|
|
</plugin>
|
|
|
|
|
</plugins>
|
|
|
|
|
</build>
|
|
|
|
|
</project>
|