Files
light/pom.xml
Doubleyin 5ab04f8d14
Some checks failed
构建并部署 Spring Boot 应用 / build-and-deploy (push) Failing after 1m30s
非远程读取修改deepseek
2025-09-28 02:55:19 +08:00

214 lines
8.5 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>
<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>
<version>3.3.1</version>
<configuration>
<from>
<image>docker://openjdk:17-jdk-slim</image> <!-- 关键修改1: 使用 docker:// 前缀明确指向本地Daemon -->
</from>
<to>
<image>light-delivery-app</image>
<tags>
<tag>latest</tag>
<tag>${project.version}</tag>
</tags>
</to>
<container>
<ports>
<port>8080</port>
<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>
<!-- 关键修改2: 强化离线模式配置 -->
<offline>true</offline>
<allowInsecureRegistries>true</allowInsecureRegistries>
</configuration>
<!-- 关键修改3: 为jib目标绑定离线模式配置 -->
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
<configuration>
<systemProperties>
<jib.allowInsecureRegistries>true</jib.allowInsecureRegistries>
</systemProperties>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>