pom.xml 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  4. <modelVersion>4.0.0</modelVersion>
  5. <parent>
  6. <groupId>com.zsjz</groupId>
  7. <artifactId>zsjz-ai</artifactId>
  8. <version>1.0</version>
  9. <!-- 模块在父仓库内,走相对路径 -->
  10. <relativePath>../pom.xml</relativePath>
  11. </parent>
  12. <artifactId>ai-gateway</artifactId>
  13. <name>ai-gateway</name>
  14. <description>按用户粘性路由的转发网关(Spring Cloud Gateway WebFlux)</description>
  15. <properties>
  16. <java.version>25</java.version>
  17. <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  18. <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
  19. <spring-cloud.version>2025.0.1</spring-cloud.version>
  20. <sa-token.version>1.46.0</sa-token.version>
  21. </properties>
  22. <dependencyManagement>
  23. <dependencies>
  24. <dependency>
  25. <groupId>org.springframework.cloud</groupId>
  26. <artifactId>spring-cloud-dependencies</artifactId>
  27. <version>${spring-cloud.version}</version>
  28. <type>pom</type>
  29. <scope>import</scope>
  30. </dependency>
  31. </dependencies>
  32. </dependencyManagement>
  33. <dependencies>
  34. <!-- Spring Cloud Gateway(WebFlux/Netty),负责流式转发(含 SSE / multipart / Range 下载) -->
  35. <dependency>
  36. <groupId>org.springframework.cloud</groupId>
  37. <artifactId>spring-cloud-starter-gateway-server-webflux</artifactId>
  38. </dependency>
  39. <dependency>
  40. <groupId>org.springframework.boot</groupId>
  41. <artifactId>spring-boot-starter-webflux</artifactId>
  42. </dependency>
  43. <!-- 网关配置与用户路由持久化(PostgreSQL),阻塞调用统一放 boundedElastic -->
  44. <dependency>
  45. <groupId>org.springframework.boot</groupId>
  46. <artifactId>spring-boot-starter-jdbc</artifactId>
  47. </dependency>
  48. <!-- 仅用 IdWorker 的雪花 ID(与 ai-server 的 MyBatis-Plus 主键策略一致) -->
  49. <dependency>
  50. <groupId>com.baomidou</groupId>
  51. <artifactId>mybatis-plus-core</artifactId>
  52. <version>3.5.17</version>
  53. </dependency>
  54. <dependency>
  55. <groupId>org.postgresql</groupId>
  56. <artifactId>postgresql</artifactId>
  57. </dependency>
  58. <!-- 网关自身的路由缓存(gateway:token / gateway:route:*) -->
  59. <dependency>
  60. <groupId>org.springframework.boot</groupId>
  61. <artifactId>spring-boot-starter-data-redis-reactive</artifactId>
  62. </dependency>
  63. <!-- sa-token:只用来解析 token -> loginId(共享后端同一个 Redis)。
  64. 版本、Redis 地址、sa-token 配置必须与 ai-server 完全一致,
  65. 否则 token 键位对不上会全部解析失败。 -->
  66. <dependency>
  67. <groupId>cn.dev33</groupId>
  68. <artifactId>sa-token-reactor-spring-boot3-starter</artifactId>
  69. <version>${sa-token.version}</version>
  70. </dependency>
  71. <dependency>
  72. <groupId>cn.dev33</groupId>
  73. <artifactId>sa-token-redis-jackson</artifactId>
  74. <version>${sa-token.version}</version>
  75. </dependency>
  76. <dependency>
  77. <groupId>org.springframework.boot</groupId>
  78. <artifactId>spring-boot-starter-validation</artifactId>
  79. </dependency>
  80. <dependency>
  81. <groupId>org.projectlombok</groupId>
  82. <artifactId>lombok</artifactId>
  83. <optional>true</optional>
  84. </dependency>
  85. <dependency>
  86. <groupId>org.springframework.boot</groupId>
  87. <artifactId>spring-boot-starter-test</artifactId>
  88. <scope>test</scope>
  89. </dependency>
  90. <dependency>
  91. <groupId>io.projectreactor</groupId>
  92. <artifactId>reactor-test</artifactId>
  93. <scope>test</scope>
  94. </dependency>
  95. </dependencies>
  96. <build>
  97. <plugins>
  98. <plugin>
  99. <groupId>org.springframework.boot</groupId>
  100. <artifactId>spring-boot-maven-plugin</artifactId>
  101. </plugin>
  102. <plugin>
  103. <groupId>org.apache.maven.plugins</groupId>
  104. <artifactId>maven-resources-plugin</artifactId>
  105. <executions>
  106. <!-- DDL 只维护一份:把仓库根的 sql/gateway.sql 复制成 classpath:db/gateway.sql,
  107. 供 spring.sql.init 启动时建表(幂等,可重复执行) -->
  108. <execution>
  109. <id>copy-gateway-sql</id>
  110. <phase>generate-resources</phase>
  111. <goals>
  112. <goal>copy-resources</goal>
  113. </goals>
  114. <configuration>
  115. <outputDirectory>${project.build.outputDirectory}</outputDirectory>
  116. <resources>
  117. <resource>
  118. <directory>${project.parent.basedir}/sql</directory>
  119. <includes>
  120. <include>gateway.sql</include>
  121. </includes>
  122. <targetPath>db</targetPath>
  123. </resource>
  124. </resources>
  125. </configuration>
  126. </execution>
  127. </executions>
  128. </plugin>
  129. <plugin>
  130. <groupId>org.apache.maven.plugins</groupId>
  131. <artifactId>maven-compiler-plugin</artifactId>
  132. <configuration>
  133. <annotationProcessorPaths>
  134. <path>
  135. <groupId>org.projectlombok</groupId>
  136. <artifactId>lombok</artifactId>
  137. </path>
  138. </annotationProcessorPaths>
  139. </configuration>
  140. </plugin>
  141. </plugins>
  142. </build>
  143. </project>