354 lines
17 KiB
XML
354 lines
17 KiB
XML
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||
<modelVersion>4.0.0</modelVersion>
|
||
|
||
<parent>
|
||
<groupId>org.springframework.boot</groupId>
|
||
<artifactId>spring-boot-starter-parent</artifactId>
|
||
<version>3.3.9</version>
|
||
<relativePath/>
|
||
</parent>
|
||
|
||
<groupId>com.nanri</groupId>
|
||
<artifactId>aiimage-backend</artifactId>
|
||
<version>0.0.1-SNAPSHOT</version>
|
||
<name>aiimage-backend</name>
|
||
<description>AI image backend service</description>
|
||
|
||
<properties>
|
||
<java.version>21</java.version>
|
||
<knife4j.version>4.5.0</knife4j.version>
|
||
<mybatis-plus.version>3.5.7</mybatis-plus.version>
|
||
<hutool.version>5.8.36</hutool.version>
|
||
<rocketmq-spring.version>2.3.5</rocketmq-spring.version>
|
||
<minio.version>8.6.0</minio.version>
|
||
<javassist.version>3.28.0-GA</javassist.version>
|
||
<jjwt.version>0.12.6</jjwt.version>
|
||
<bouncycastle.version>1.86</bouncycastle.version>
|
||
<!-- 覆盖 spring-boot-dependencies 3.3.9 托管的传递版本(OSV 2026-10-11:docs/依赖漏洞与升级面-2026-10-11.md)。
|
||
前三行是同一补丁线内的钉版;jackson 跨到 2.18 线。 -->
|
||
<tomcat.version>10.1.60</tomcat.version>
|
||
<netty.version>4.1.139.Final</netty.version>
|
||
<spring-security.version>6.3.10</spring-security.version>
|
||
<jackson-bom.version>2.18.11</jackson-bom.version>
|
||
</properties>
|
||
|
||
<dependencyManagement>
|
||
<dependencies>
|
||
<dependency>
|
||
<groupId>org.javassist</groupId>
|
||
<artifactId>javassist</artifactId>
|
||
<version>${javassist.version}</version>
|
||
</dependency>
|
||
</dependencies>
|
||
</dependencyManagement>
|
||
|
||
<dependencies>
|
||
<dependency>
|
||
<groupId>org.springframework.boot</groupId>
|
||
<artifactId>spring-boot-starter-web</artifactId>
|
||
</dependency>
|
||
<dependency>
|
||
<groupId>org.springframework.boot</groupId>
|
||
<artifactId>spring-boot-starter-validation</artifactId>
|
||
</dependency>
|
||
<dependency>
|
||
<groupId>org.springframework.boot</groupId>
|
||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||
</dependency>
|
||
<dependency>
|
||
<groupId>org.springframework.boot</groupId>
|
||
<artifactId>spring-boot-starter-security</artifactId>
|
||
</dependency>
|
||
<dependency>
|
||
<groupId>org.springframework.boot</groupId>
|
||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||
</dependency>
|
||
<dependency>
|
||
<groupId>com.baomidou</groupId>
|
||
<artifactId>mybatis-plus-spring-boot3-starter</artifactId>
|
||
<version>${mybatis-plus.version}</version>
|
||
</dependency>
|
||
<dependency>
|
||
<groupId>com.mysql</groupId>
|
||
<artifactId>mysql-connector-j</artifactId>
|
||
<scope>runtime</scope>
|
||
</dependency>
|
||
<dependency>
|
||
<groupId>org.flywaydb</groupId>
|
||
<artifactId>flyway-core</artifactId>
|
||
</dependency>
|
||
<dependency>
|
||
<groupId>org.flywaydb</groupId>
|
||
<artifactId>flyway-mysql</artifactId>
|
||
</dependency>
|
||
<dependency>
|
||
<groupId>org.apache.poi</groupId>
|
||
<artifactId>poi-ooxml</artifactId>
|
||
<version>5.4.1</version>
|
||
</dependency>
|
||
<dependency>
|
||
<groupId>com.github.xiaoymin</groupId>
|
||
<artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
|
||
<version>${knife4j.version}</version>
|
||
</dependency>
|
||
<dependency>
|
||
<groupId>cn.hutool</groupId>
|
||
<artifactId>hutool-all</artifactId>
|
||
<version>${hutool.version}</version>
|
||
</dependency>
|
||
<dependency>
|
||
<groupId>org.apache.rocketmq</groupId>
|
||
<artifactId>rocketmq-spring-boot-starter</artifactId>
|
||
<version>${rocketmq-spring.version}</version>
|
||
<exclusions>
|
||
<!-- 2026-11-03 流程稳定性蓝图 Phase 1(流程稳定性与性能优化)依赖瘦身。
|
||
判据全部来自 mvn -o dependency:tree + 对 rocketmq 系 jar 的字节码常量池扫描
|
||
(本机 D:/dev/m2/repository,2026-11-03 实测),不是拍脑袋:
|
||
|
||
[CN-04] hamcrest/awaitility:rocketmq-spring-boot 2.3.5 把自家测试库错标成
|
||
compile 依赖泄进 fat jar;7 支 rocketmq 运行时 jar 扫描 0 引用 ⇒ 排除。
|
||
|
||
[S-be-3] 本服务 MQ 只走 name-server remoting(application.yml:
|
||
rocketmq.name-server=:9876,@RocketMQMessageListener = spring starter
|
||
的 remoting 路径),gRPC proxy 路径运行期不加载:
|
||
- rocketmq-proto + protobuf-java(-util):只被 proto 的 gRPC stub 与
|
||
rocketmq-acl 的 PlainAccessValidator 引用(ACL 未启用不加载);
|
||
- io.grpc 五件:rocketmq-client/remoting/acl 扫描里只有 common 的
|
||
GrpcConstants 引用(remoting 路径 0 引用);
|
||
- zstd-jni:只被 ZstdCompressor 引用(仅消息压缩档配 ZSTD 才加载);
|
||
- snappy-java:全链 0 引用;
|
||
- opentelemetry 导出器全家(otlp/prometheus/logging/sender):
|
||
传输路径类(NettyRemotingAbstract/RemotingMetricsManager/Nop*)
|
||
只引用 api/+sdk/ 子包,exporter/ 子包 0 引用 ⇒ 排除导出器、
|
||
保留 api+sdk(remoting 指标门面照常工作)。
|
||
|
||
[S-be-2] fastjson2:只被 ACL 模型枚举与 AclUtils 引用(ACL 关闭不加载)。
|
||
⚠ fastjson1 (com.alibaba:fastjson) 与 guava 必须保留——字节码扫描实锤
|
||
rocketmq-remoting 的 RemotingCommand/HeartbeatData/SubscriptionData 与
|
||
NettyRemotingClient 等 10/41 个 remoting 线路类引用它们,排除=生产
|
||
任务队列运行期 NoClassDefFoundError。审计"src 零 import"只覆盖我们
|
||
自己的代码,证不了 rocketmq 内部引用,两条放弃并在此留痕。
|
||
|
||
红线:发版后必须核对 MQ 真实收发(任务队列 + 结果文件队列各一条),
|
||
字节码扫描+整量测试+真机启动都盖不到生产 broker 上的线路行为。 -->
|
||
<exclusion>
|
||
<groupId>org.hamcrest</groupId>
|
||
<artifactId>hamcrest</artifactId>
|
||
</exclusion>
|
||
<exclusion>
|
||
<groupId>org.awaitility</groupId>
|
||
<artifactId>awaitility</artifactId>
|
||
</exclusion>
|
||
<exclusion>
|
||
<groupId>com.alibaba.fastjson2</groupId>
|
||
<artifactId>fastjson2</artifactId>
|
||
</exclusion>
|
||
<exclusion>
|
||
<groupId>org.xerial.snappy</groupId>
|
||
<artifactId>snappy-java</artifactId>
|
||
</exclusion>
|
||
<exclusion>
|
||
<groupId>com.github.luben</groupId>
|
||
<artifactId>zstd-jni</artifactId>
|
||
</exclusion>
|
||
<exclusion>
|
||
<groupId>org.apache.rocketmq</groupId>
|
||
<artifactId>rocketmq-proto</artifactId>
|
||
</exclusion>
|
||
<exclusion>
|
||
<groupId>com.google.protobuf</groupId>
|
||
<artifactId>protobuf-java</artifactId>
|
||
</exclusion>
|
||
<exclusion>
|
||
<groupId>com.google.protobuf</groupId>
|
||
<artifactId>protobuf-java-util</artifactId>
|
||
</exclusion>
|
||
<exclusion>
|
||
<groupId>io.grpc</groupId>
|
||
<artifactId>grpc-netty-shaded</artifactId>
|
||
</exclusion>
|
||
<exclusion>
|
||
<groupId>io.grpc</groupId>
|
||
<artifactId>grpc-core</artifactId>
|
||
</exclusion>
|
||
<exclusion>
|
||
<groupId>io.grpc</groupId>
|
||
<artifactId>grpc-stub</artifactId>
|
||
</exclusion>
|
||
<exclusion>
|
||
<groupId>io.grpc</groupId>
|
||
<artifactId>grpc-api</artifactId>
|
||
</exclusion>
|
||
<exclusion>
|
||
<groupId>io.grpc</groupId>
|
||
<artifactId>grpc-context</artifactId>
|
||
</exclusion>
|
||
<exclusion>
|
||
<groupId>io.opentelemetry</groupId>
|
||
<artifactId>opentelemetry-exporter-otlp</artifactId>
|
||
</exclusion>
|
||
<exclusion>
|
||
<groupId>io.opentelemetry</groupId>
|
||
<artifactId>opentelemetry-exporter-otlp-common</artifactId>
|
||
</exclusion>
|
||
<exclusion>
|
||
<groupId>io.opentelemetry</groupId>
|
||
<artifactId>opentelemetry-exporter-common</artifactId>
|
||
</exclusion>
|
||
<exclusion>
|
||
<groupId>io.opentelemetry</groupId>
|
||
<artifactId>opentelemetry-exporter-sender-okhttp</artifactId>
|
||
</exclusion>
|
||
<exclusion>
|
||
<groupId>io.opentelemetry</groupId>
|
||
<artifactId>opentelemetry-exporter-prometheus</artifactId>
|
||
</exclusion>
|
||
<exclusion>
|
||
<groupId>io.opentelemetry</groupId>
|
||
<artifactId>opentelemetry-exporter-logging</artifactId>
|
||
</exclusion>
|
||
<exclusion>
|
||
<groupId>io.opentelemetry</groupId>
|
||
<artifactId>opentelemetry-exporter-logging-otlp</artifactId>
|
||
</exclusion>
|
||
<exclusion>
|
||
<groupId>io.opentelemetry</groupId>
|
||
<artifactId>opentelemetry-sdk-extension-autoconfigure-spi</artifactId>
|
||
</exclusion>
|
||
</exclusions>
|
||
</dependency>
|
||
<dependency>
|
||
<groupId>io.minio</groupId>
|
||
<artifactId>minio</artifactId>
|
||
<version>${minio.version}</version>
|
||
<!-- 2026-11-03 实录:曾试排除传递的 snappy-java(字节码扫描只见 uploadSnowballObjects
|
||
一条冷门引用),整量一跑 MinioClient$Builder.<init> 当场
|
||
NoClassDefFoundError: SnappyFramedOutputStream——minio 在 Builder 构造期就急切
|
||
解析 snappy 类,静态扫描判不了初始化期的类加载。已撤销,snappy 必须保留。 -->
|
||
</dependency>
|
||
<dependency>
|
||
<groupId>org.bouncycastle</groupId>
|
||
<artifactId>bcprov-jdk18on</artifactId>
|
||
<version>${bouncycastle.version}</version>
|
||
</dependency>
|
||
<dependency>
|
||
<groupId>io.jsonwebtoken</groupId>
|
||
<artifactId>jjwt-api</artifactId>
|
||
<version>${jjwt.version}</version>
|
||
</dependency>
|
||
<dependency>
|
||
<groupId>io.jsonwebtoken</groupId>
|
||
<artifactId>jjwt-impl</artifactId>
|
||
<version>${jjwt.version}</version>
|
||
<scope>runtime</scope>
|
||
</dependency>
|
||
<dependency>
|
||
<groupId>io.jsonwebtoken</groupId>
|
||
<artifactId>jjwt-jackson</artifactId>
|
||
<version>${jjwt.version}</version>
|
||
<scope>runtime</scope>
|
||
</dependency>
|
||
<dependency>
|
||
<groupId>org.projectlombok</groupId>
|
||
<artifactId>lombok</artifactId>
|
||
<!-- 2026-11-03 瘦身审计 CN-03:lombok 是纯编译期注解处理器,运行期零用途;
|
||
原先只有 optional 没 provided,spring-boot repackage 照打进 BOOT-INF/lib
|
||
(实测 2,054,266 B)。annotationProcessorPaths 已单独钉 1.18.36,编译不受影响。 -->
|
||
<scope>provided</scope>
|
||
<optional>true</optional>
|
||
</dependency>
|
||
<dependency>
|
||
<groupId>org.springframework.boot</groupId>
|
||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||
<optional>true</optional>
|
||
</dependency>
|
||
<dependency>
|
||
<groupId>org.springframework.boot</groupId>
|
||
<artifactId>spring-boot-starter-test</artifactId>
|
||
<scope>test</scope>
|
||
</dependency>
|
||
<dependency>
|
||
<groupId>com.tngtech.archunit</groupId>
|
||
<artifactId>archunit-junit5</artifactId>
|
||
<version>1.3.0</version>
|
||
<scope>test</scope>
|
||
</dependency>
|
||
</dependencies>
|
||
|
||
<build>
|
||
<plugins>
|
||
<plugin>
|
||
<groupId>org.springframework.boot</groupId>
|
||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||
<configuration>
|
||
<!-- 文档 UI 的两件 webjars 垃圾挤包:
|
||
swagger-ui-5.10.3.jar 3.83 MB + knife4j-openapi3-ui-4.5.0.jar 3.48 MB = 7.31 MB,
|
||
实测自现网归档 jar(BOOT-INF/lib 218 支 / 未压缩 136.1 MB)——
|
||
application-server.yml 三处 enabled:false 只关接口,关掉不了字节。
|
||
这里挪的是 repackage 的 fat jar,不动依赖声明 => mvn spring-boot:run / IDE
|
||
走的是 Maven classpath,本地 dev 仍然能打开 doc.html;而 annotation (io.swagger.v3
|
||
的 515 处 import)不受影响。
|
||
另注:包变瘦 7.31 MB 正卡 scripts/_deploy_jar_and_restart_both.py 的
|
||
SIZE_TOLERANCE=0.05 下沿 => SIZE_BASELINE 必须与本改动同批改、同批发布。 -->
|
||
<excludes>
|
||
<exclude>
|
||
<groupId>org.webjars</groupId>
|
||
<artifactId>swagger-ui</artifactId>
|
||
</exclude>
|
||
<exclude>
|
||
<groupId>com.github.xiaoymin</groupId>
|
||
<artifactId>knife4j-openapi3-ui</artifactId>
|
||
</exclude>
|
||
</excludes>
|
||
</configuration>
|
||
</plugin>
|
||
<plugin>
|
||
<groupId>org.apache.maven.plugins</groupId>
|
||
<artifactId>maven-compiler-plugin</artifactId>
|
||
<configuration>
|
||
<source>${java.version}</source>
|
||
<target>${java.version}</target>
|
||
<parameters>true</parameters>
|
||
<annotationProcessorPaths>
|
||
<path>
|
||
<groupId>org.projectlombok</groupId>
|
||
<artifactId>lombok</artifactId>
|
||
<version>1.18.36</version>
|
||
</path>
|
||
</annotationProcessorPaths>
|
||
</configuration>
|
||
</plugin>
|
||
<plugin>
|
||
<groupId>org.apache.maven.plugins</groupId>
|
||
<artifactId>maven-jar-plugin</artifactId>
|
||
<configuration>
|
||
<!-- db/aiimage.sql 是一份 120MB+ 的生产库 Navicat 转储(含 biz_shop_key 等真实
|
||
数据行),Flyway 不认它(无 V<n>__ 前缀),而默认资源打包会原样塞进
|
||
BOOT-INF/classes/ —— 于是每台服务器上的运行 jar 里都带着一份生产数据快照。
|
||
转储本体已于 2026-10-07 移出仓库,只留在本地 gitignored 的 backend-java/data/;
|
||
这条 exclude 留着当反向钉:谁再把它放回 resources/db/ 也进不了 jar。 -->
|
||
<excludes>
|
||
<exclude>db/aiimage.sql</exclude>
|
||
<!-- application-local.yml 是 gitignore 的本机开发配置(本机库/OSS/内部令牌等
|
||
一套非生产值,形同密钥),src/main/resources 下人人有、而 mvn 打包不看
|
||
gitignore ⇒ 谁从主树随手 package 都会把它夹进 BOOT-INF/classes。
|
||
2026-10-09 实测 12:23~18:49 在线的三个包均夹带本机该文件(经 _prod_config
|
||
指纹比对,其值≠现行生产密钥,未成实害),当天起出包一律隔离 worktree;
|
||
这条 exclude 是第二道钉——只拦入 jar,target/classes 不受影响,
|
||
本地 IDE / run-local.cmd 照常读得到。 -->
|
||
<exclude>application-local.yml</exclude>
|
||
</excludes>
|
||
</configuration>
|
||
</plugin>
|
||
<plugin>
|
||
<groupId>org.apache.maven.plugins</groupId>
|
||
<artifactId>maven-surefire-plugin</artifactId>
|
||
<configuration>
|
||
<argLine>-XX:+EnableDynamicAgentLoading -Xshare:off -Xmx1536m -XX:MaxMetaspaceSize=512m</argLine>
|
||
</configuration>
|
||
</plugin>
|
||
</plugins>
|
||
</build>
|
||
</project>
|