缺失 everit-json-schema 依赖
# 背景说明
在对 Hudi 1.0.1 版本进行源码编译时,出现了 hudi-utilities_2.12
模块构建失败的情况。如下是当时控制台日志输出的片段:
[INFO] hudi-spark3.5.x_2.12 ............................... SUCCESS [02:37 min]
[INFO] hudi-java-client ................................... SUCCESS [ 43.893 s]
[INFO] hudi-spark_2.12 .................................... SUCCESS [03:46 min]
[INFO] hudi-gcp ........................................... SUCCESS [08:10 min]
[INFO] hudi-utilities_2.12 ................................ FAILURE [24:31 min]
[INFO] hudi-utilities-bundle_2.12 ......................... SKIPPED
[INFO] hudi-cli ........................................... SKIPPED
[INFO] hudi-flink-client .................................. SKIPPED
[INFO] hudi-datahub-sync .................................. SKIPPED
[INFO] hudi-adb-sync ...................................... SKIPPED
[INFO] hudi-sync .......................................... SKIPPED
[INFO] hudi-hadoop-mr-bundle .............................. SKIPPED
[INFO] hudi-datahub-sync-bundle ........................... SKIPPED
[INFO] hudi-hive-sync-bundle .............................. SKIPPED
[INFO] hudi-aws-bundle .................................... SKIPPED
[INFO] hudi-gcp-bundle .................................... SKIPPED
[INFO] hudi-spark3.5-bundle_2.12 .......................... SKIPPED
[INFO] hudi-presto-bundle ................................. SKIPPED
[INFO] hudi-utilities-slim-bundle_2.12 .................... SKIPPED
[INFO] hudi-timeline-server-bundle ........................ SKIPPED
[INFO] hudi-trino-bundle .................................. SKIPPED
[INFO] hudi-examples ...................................... SKIPPED
[INFO] hudi-examples-common ............................... SKIPPED
[INFO] hudi-examples-spark ................................ SKIPPED
[INFO] hudi-flink-datasource .............................. SKIPPED
[INFO] hudi-flink1.17.x ................................... SKIPPED
[INFO] hudi-flink ......................................... SKIPPED
[INFO] hudi-examples-flink ................................ SKIPPED
[INFO] hudi-examples-java ................................. SKIPPED
[INFO] hudi-flink1.17-bundle .............................. SKIPPED
[INFO] hudi-examples-k8s .................................. SKIPPED
[INFO] hudi-flink1.14.x ................................... SKIPPED
[INFO] hudi-flink1.15.x ................................... SKIPPED
[INFO] hudi-flink1.16.x ................................... SKIPPED
[INFO] hudi-flink1.18.x ................................... SKIPPED
[INFO] hudi-flink1.19.x ................................... SKIPPED
[INFO] hudi-flink1.20.x ................................... SKIPPED
[INFO] hudi-kafka-connect ................................. SKIPPED
[INFO] hudi-kafka-connect-bundle .......................... SKIPPED
[INFO] hudi-cli-bundle_2.12 ............................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:20 h
[INFO] Finished at: 2025-04-22T03:12:53Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project hudi-utilities_2.12: Could not resolve dependencies for project org.apache.hudi:hudi-utilities_2.12:jar:1.0.1: Could not find artifact com.github.everit-org.json-sche
ma:org.everit.json.schema:jar:1.12.1 in nexus (http://172.20.0.2:8081/repository/maven-public/) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <args> -rf :hudi-utilities_2.12
(base) [root@centos1 hudi-release-1.0.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
其余模块全部被跳过,整次构建耗时超过一小时构建模块失败 。
# 问题定位
我们第一时间检查 Nexus 私服配置,从报错日志可以看出:
提示
Maven 正在尝试从我们自建的 Nexus 仓库拉取依赖:
http://172.20.0.2:8081/repository/maven-public/
我们随后通过 mvnrepository
网站查询该依赖的 GAV:
<groupId>com.github.everit-org.json-schema</groupId>
<artifactId>org.everit.json.schema</artifactId>
<version>1.12.1</version>
2
3
4
搜索后发现如下:
其归属的是 Mulesoft 仓库,详情: 仓库地址 (opens new window)
但很不幸,我们发现 1.12.1
这个版本已经在该仓库中不存在了:
# 问题解决
分析完原因后,我们提出两条解决思路:
# 🚧思路一:排除掉无法拉取的依赖,替换为兼容版本
考虑到构建失败的 jar 并未实际使用,而是被 confluent
相关组件传递依赖引用了,因此我们尝试通过 exclusion
将其剔除,再手动引入新的兼容依赖。
对 hudi-utilities/pom.xml
做如下修改:
<dependency>
<groupId>com.github.erosb</groupId>
<artifactId>everit-json-schema</artifactId>
<version>1.12.1</version>
</dependency>
2
3
4
5
6
并在所有使用 confluent 组件的依赖中添加排除语句:
<exclusion>
<groupId>com.github.everit-org.json-schema</groupId>
<artifactId>org.everit.json.schema</artifactId>
</exclusion>
2
3
4
5
注意
你可能会在以下模块中都发现了 everit 的传递依赖:
- kafka-avro-serializer
- kafka-schema-registry-client
- kafka-protobuf-serializer
- kafka-json-schema-serializer
这种方式下,项目不再依赖失效的 gav,而是主动声明可用的 GAV,从而绕过失效源。
# 🚧 思路二:修改 Nexus 增加 Mulesoft 仓库(不推荐)
理论上,你可以尝试将 https://repository.mulesoft.org/nexus/content/repositories/public/ (opens new window)
这个源加入 Nexus 配置并合并到 maven-public
聚合仓中。
但由于该仓库本身已经不再维护这个版本,最终下载失败的概率依然极高。
警告
此方法网络不稳定,且维护成本较高,因此不推荐。
# 最终验证
在修改 pom.xml
后,我们重新编译 Hudi 工程,hudi-utilities_2.12
编译成功。