Files
light/pom.xml
Doubleyin 31e61cf571
All checks were successful
构建并部署 Spring Boot 应用 / build-and-deploy (push) Successful in 30m46s
移除redis的一来
2025-10-14 22:53:27 +08:00

232 lines
9.2 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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>
<!-- 移除 Redis 依赖 -->
<!--
<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>
<!-- ========== Actuator for Health Check ========== -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</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>
<!-- 添加资源插件以确保正确处理UTF-8编码 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.1</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<!-- Jib Docker Plugin -->
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<version>3.4.2</version>
<configuration>
<from>
<!-- 明确指定使用本地 Docker 守护进程 -->
<image>docker://openjdk:17-jdk-slim</image>
</from>
<to>
<image>light-delivery-app</image>
<tags>
<tag>latest</tag>
<tag>${project.version}</tag>
</tags>
</to>
<container>
<ports>
<port>8443</port>
</ports>
<environment>
<SPRING_PROFILES_ACTIVE>prod</SPRING_PROFILES_ACTIVE>
</environment>
<creationTime>USE_CURRENT_TIMESTAMP</creationTime>
<!-- 添加主类配置 -->
<mainClass>com.light.delivery.LightApplication</mainClass>
</container>
<!-- 强化离线配置 -->
<offline>true</offline>
<!-- 不验证远程仓库 -->
<allowInsecureRegistries>true</allowInsecureRegistries>
<!-- 不拉取父镜像 -->
<pullParent>false</pullParent>
<!-- 镜像标签配置 -->
<outputPaths>
<tar>${project.build.directory}/jib-image.tar</tar>
</outputPaths>
<!-- 优化CI/CD构建 -->
<containerizingMode>packaged</containerizingMode>
<!-- 其他优化配置 -->
<skip>false</skip>
<useOnlyProjectProperties>true</useOnlyProjectProperties>
</configuration>
</plugin>
</plugins>
</build>
</project>