[O] Hudi 版本适配改造(一)
# 背景说明
Hudi 在大数据集成场景下,常因依赖冲突、缺失或不兼容导致编译失败。 典型如 everit-json-schema 冲突、javax.annotation 缺失等。 这类问题需针对各模块逐一排查、补全或排除依赖。依赖适配
# 适配思路
- 对涉及依赖冲突或缺失的每个子模块,需单独调整依赖声明;
- 对于 kafka-avro-serializer、kafka-schema-registry-client 等依赖,需排除旧版 json-schema;
- 手动补充 everit-json-schema 兼容包和 javax.annotation。
提示
建议重点关注 hudi-utilities、hudi-io 等子模块的 pom.xml,逐一处理依赖问题,不能只在父工程声明。
# 实操步骤
# 1. 补丁文件准备
将以下补丁文件,放入对应 patch 目录,确保可自动应用。
# 2. 关键 diff 内容
针对 hudi-utilities/pom.xml 需对 confluent 相关依赖统一添加 exclusions,并补充 everit-json-schema 新版依赖:
+ <exclusions>
+ <exclusion>
+ <groupId>com.github.everit-org.json-schema</groupId>
+ <artifactId>org.everit.json.schema</artifactId>
+ </exclusion>
+ </exclusions>
1
2
3
4
5
6
2
3
4
5
6
+ <dependency>
+ <groupId>com.github.erosb</groupId>
+ <artifactId>everit-json-schema</artifactId>
+ <version>1.12.1</version>
+ </dependency>
1
2
3
4
5
2
3
4
5
针对 hudi-io/pom.xml 需补充 javax.annotation 依赖,且指定 hadoop-common 的 exclusions:
+ <dependency>
+ <groupId>javax.annotation</groupId>
+ <artifactId>javax.annotation-api</artifactId>
+ <version>1.3.2</version>
+ <scope>compile</scope>
+ <optional>false</optional>
+ </dependency>
1
2
3
4
5
6
7
2
3
4
5
6
7
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-common</artifactId>
+ <version>${hadoop.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.annotation</groupId>
+ <artifactId>javax.annotation-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
# 修改位置汇总
模块目录 | 文件路径 | 关键修改 |
---|---|---|
hudi-utilities | hudi-utilities/pom.xml | 排除 json-schema 冲突、补 everit |
hudi-io | hudi-io/pom.xml | 增 javax.annotation,调 hadoop-common exclusions |
笔记
建议所有与 hadoop、kafka-avro 相关模块同步排查依赖问题,升级时也需关注依赖兼容。依赖排查
# 完整 diff 文件参考
Subject: [PATCH] fixed: 解决编译报错问题
---
Index: hudi-utilities/pom.xml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/hudi-utilities/pom.xml b/hudi-utilities/pom.xml
--- a/hudi-utilities/pom.xml (revision 3a814a3594e7cad951a80d3aef3a196bee40e850)
+++ b/hudi-utilities/pom.xml (date 1745303058467)
@@ -361,6 +361,12 @@
<dependency>
<groupId>io.confluent</groupId>
<artifactId>kafka-avro-serializer</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>com.github.everit-org.json-schema</groupId>
+ <artifactId>org.everit.json.schema</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>io.confluent</groupId>
@@ -374,14 +380,37 @@
<dependency>
<groupId>io.confluent</groupId>
<artifactId>kafka-schema-registry-client</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>com.github.everit-org.json-schema</groupId>
+ <artifactId>org.everit.json.schema</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>com.github.erosb</groupId>
+ <artifactId>everit-json-schema</artifactId>
+ <version>1.12.1</version>
</dependency>
<dependency>
<groupId>io.confluent</groupId>
<artifactId>kafka-protobuf-serializer</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>com.github.everit-org.json-schema</groupId>
+ <artifactId>org.everit.json.schema</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>io.confluent</groupId>
<artifactId>kafka-json-schema-serializer</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>com.github.everit-org.json-schema</groupId>
+ <artifactId>org.everit.json.schema</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>com.kjetland</groupId>
Index: hudi-io/pom.xml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/hudi-io/pom.xml b/hudi-io/pom.xml
--- a/hudi-io/pom.xml (revision 3a814a3594e7cad951a80d3aef3a196bee40e850)
+++ b/hudi-io/pom.xml (date 1745286038121)
@@ -143,5 +143,25 @@
<version>${slf4j.version}</version>
<scope>provided</scope>
</dependency>
+
+ <dependency>
+ <groupId>javax.annotation</groupId>
+ <artifactId>javax.annotation-api</artifactId>
+ <version>1.3.2</version>
+ <scope>compile</scope>
+ <optional>false</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-common</artifactId>
+ <version>${hadoop.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.annotation</groupId>
+ <artifactId>javax.annotation-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
</dependencies>
</project>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
- 01
- bigtop-select 打包缺 compat 报错修复 deb07-16
- 02
- bigtop-select 打包缺 control 文件报错修复 deb07-16
- 03
- 首次编译-环境初始化 必装07-16