- 添加Nacos配置中心依赖并启用配置导入功能 - 将网关日志配置外置到Nacos gateway-server.yaml文件 - 将业务模块日志文件路径配置外置到Nacos rdms-common.yaml - 在pom.xml中设置addResources为false避免占位符不被替换 - 添加logback-spring.xml配置文件用于日志格式化和滚动策略 - 优化日志配置管理方式,实现按环境统一配置
102 lines
3.6 KiB
XML
102 lines
3.6 KiB
XML
<?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>
|
||
<parent>
|
||
<groupId>com.njcn</groupId>
|
||
<artifactId>cn-rdms</artifactId>
|
||
<version>${revision}</version>
|
||
</parent>
|
||
|
||
<artifactId>rdms-gateway</artifactId>
|
||
<packaging>jar</packaging>
|
||
|
||
<name>${project.artifactId}</name>
|
||
<description>API 服务网关,基于 Spring Cloud Gateway 实现</description>
|
||
<url>https://github.com/YunaiV/rdms-cloud</url>
|
||
|
||
|
||
<dependencies>
|
||
<!-- 业务组件 -->
|
||
<dependency>
|
||
<groupId>com.njcn</groupId>
|
||
<artifactId>rdms-system-api</artifactId>
|
||
<version>${revision}</version>
|
||
<exclusions>
|
||
<exclusion>
|
||
<groupId>org.springdoc</groupId>
|
||
<artifactId>springdoc-openapi-webmvc-core</artifactId>
|
||
</exclusion>
|
||
</exclusions>
|
||
</dependency>
|
||
|
||
<!-- Gateway 网关相关 -->
|
||
<dependency>
|
||
<groupId>org.springframework.cloud</groupId>
|
||
<artifactId>spring-cloud-starter-gateway-server-webflux</artifactId>
|
||
</dependency>
|
||
|
||
<dependency>
|
||
<groupId>com.github.xiaoymin</groupId> <!-- 接口文档 -->
|
||
<artifactId>knife4j-gateway-spring-boot-starter</artifactId>
|
||
</dependency>
|
||
|
||
<!-- RPC 远程调用相关 -->
|
||
<dependency>
|
||
<groupId>org.springframework.cloud</groupId>
|
||
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
|
||
</dependency>
|
||
|
||
<!-- Registry 注册中心相关 -->
|
||
<dependency>
|
||
<groupId>com.alibaba.cloud</groupId>
|
||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||
</dependency>
|
||
|
||
<!-- Config 配置中心相关 -->
|
||
<dependency>
|
||
<groupId>com.alibaba.cloud</groupId>
|
||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||
</dependency>
|
||
|
||
<!-- 工具类相关 -->
|
||
<dependency>
|
||
<groupId>com.google.guava</groupId>
|
||
<artifactId>guava</artifactId>
|
||
</dependency>
|
||
|
||
<dependency>
|
||
<!-- 必须引入,否则会有 https://gitee.com/rdmscode/rdms-cloud-mini/issues/IB5PXW 告警 -->
|
||
<groupId>com.github.ben-manes.caffeine</groupId>
|
||
<artifactId>caffeine</artifactId>
|
||
</dependency>
|
||
</dependencies>
|
||
|
||
|
||
<build>
|
||
<!-- 设置构建的 jar 包名 -->
|
||
<finalName>${project.artifactId}</finalName>
|
||
<plugins>
|
||
<!-- 打包 -->
|
||
<plugin>
|
||
<groupId>org.springframework.boot</groupId>
|
||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||
<version>${spring.boot.version}</version>
|
||
<configuration>
|
||
<!-- 必须为 false:addResources=true 会让 spring-boot:run 直接挂载源 resources 目录、
|
||
跳过资源过滤,导致 application.yaml 里的 @nacos.xxx@ 占位符不被替换。 -->
|
||
<addResources>false</addResources>
|
||
</configuration>
|
||
<executions>
|
||
<execution>
|
||
<goals>
|
||
<goal>repackage</goal> <!-- 将引入的 jar 打入其中 -->
|
||
</goals>
|
||
</execution>
|
||
</executions>
|
||
</plugin>
|
||
</plugins>
|
||
</build>
|
||
</project>
|