refactor(phase-1): 后端依赖瘦身——CN-03 lombok provided+CN-04 测试库泄包排除+S-be-2/3 依字节码证据排 rocketmq 死重(fastjson1/guava/snappy 保留留痕)
This commit is contained in:
@@ -101,11 +101,131 @@
|
||||
<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>
|
||||
@@ -132,6 +252,10 @@
|
||||
<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>
|
||||
|
||||
Reference in New Issue
Block a user