【Knox编译】xmlsectool 依赖缺失问题解析

一、问题背景

代码已经提交到github,完整代码请参考:Ttbigdata

在基于 Bigtop 编译 Apache Knox 2.1.0 的过程中,整体构建已经进入后半段,大量模块显示为 SKIPPED,但在处理安全相关模块时构建突然中断。

从构建路径和模块名称可以判断,此阶段已经进入 Knox 的 Provider / Security 相关实现,一旦失败,后续 Knox 组件将全部无法继续。

这类问题在 Bigtop + 内网 Nexus 的环境下非常常见,

并不属于代码问题,而是典型的 第三方 Maven 依赖缺失

二、报错信息与日志定位

核心报错信息如下:

bash 复制代码
NFO] gateway-service-session 2.1.0 ...................... SKIPPED
[INFO] gateway-release 2.1.0 .............................. SKIPPED
[INFO] gateway-service-vault 2.1.0 ........................ SKIPPED
[INFO] gateway-test-release-utils 2.1.0 ................... SKIPPED
[INFO] gateway-test 2.1.0 ................................. SKIPPED
[INFO] gateway-test-release 2.1.0 ......................... SKIPPED
[INFO] webhdfs-kerb-test 2.1.0 ............................ SKIPPED
[INFO] webhdfs-test 2.1.0 ................................. SKIPPED
[INFO] gateway-shell-release 2.1.0 ........................ SKIPPED
[INFO] gateway-docker 2.1.0 ............................... SKIPPED
[INFO] gateway-release-common 2.1.0 ....................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  12:13 min
[INFO] Finished at: 2025-12-11T02:52:38Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project gateway-provider-security-pac4j: Could not resolve dependencies for project org.apache.knox:gateway-provider-security-pac4j:jar:2.1.0: Could not find artifact net.shibboleth.tool:xmlsectool:jar:2.0.0 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 :gateway-provider-security-pac4j
(base) [root@kylin10 knox-2.1.0-RC2]#

同时可以看到构建最终状态:

bash 复制代码
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  12:13 min
[INFO] Finished at: 2025-12-11T02:52:38Z

从日志中可以提取几个关键信息点:

项目 内容
失败模块 gateway-provider-security-pac4j
缺失依赖 net.shibboleth.tool:xmlsectool:2.0.0
Maven 仓库 内部 Nexus(maven-public)
错误类型 DependencyResolutionException

三、问题根因分析

1. xmlsectool 并不在 Maven Central

xmlsectool 属于 Shibboleth 项目体系,其官方 Maven 仓库地址为:

text 复制代码
https://build.shibboleth.net/maven/releases/

该依赖 默认不发布在 Maven Central,因此:

  • 本地 Maven
  • 企业 Nexus
  • Bigtop 默认构建链路

都无法自动拉取该依赖

2. 内部 Nexus 未代理 Shibboleth 仓库

当前构建使用的仓库为:

text 复制代码
http://172.20.0.2:8081/repository/maven-public/

如果该 group 中未包含 shibboleth-releases,那么 Maven 在解析依赖时必然失败。

这个问题 和 Knox 版本无关和 Bigtop 无关

本质是 仓库覆盖不完整

四、解决方案

针对 xmlsectool 依赖缺失的问题,本质上只有一个目标:

让 Maven 能解析到 net.shibboleth.tool:xmlsectool:2.0.0

根据环境不同,可以采用两种方式。

方案一:通过 Nexus 统一托管 xmlsectool 依赖(推荐)

该方案适用于:

  • 企业内网
  • 多人协作
  • 多次重复编译 Bigtop / Ambari / Knox
1. 添加 Shibboleth Releases 仓库

在 Nexus 中新增一个 Maven Proxy Repository

  • Name:shibboleth-releases
  • Remote URL:
text 复制代码
https://build.shibboleth.net/maven/releases/
2. 加入 maven-public Group

shibboleth-releases 添加到 maven-public 组仓库中,确保构建时可以被统一解析。

3. 恢复构建
bash 复制代码
mvn compile -rf :gateway-provider-security-pac4j

-rf(resume from)是 Bigtop / Knox 编译中非常常用的参数,

可以避免从头全量重编。

4. 一键脚本方式(推荐)

如果不想手工配置 Nexus,可以直接使用我们整理的一键脚本:

bash 复制代码
https://github.com/TtBigdata/ambari-env/blob/master/scripts/system/after/nexus/setup_mvn_proxy.sh

该脚本会自动补齐:

  • Shibboleth
  • Apache Snapshots
  • 其他常见第三方 Maven 仓库

方案二:直接下载并安装到本地 Maven 仓库

该方案适用于:

  • 无法修改 Nexus
  • 临时编译
  • 单机调试环境
1. 下载 xmlsectool 依赖

官方目录地址:

text 复制代码
https://build.shibboleth.net/maven/releases/net/shibboleth/tool/xmlsectool/
2. 安装到本地仓库
bash 复制代码
mvn install:install-file \
  -DgroupId=net.shibboleth.tool \
  -DartifactId=xmlsectool \
  -Dversion=2.0.0 \
  -Dpackaging=jar \
  -Dfile=xmlsectool-2.0.0.jar
相关推荐
珠海西格电力3 小时前
零碳园区有哪些政策支持?
大数据·数据库·人工智能·物联网·能源
LJ97951113 小时前
AI如何重构媒介宣发:从资源博弈到智能匹配的技术跃迁
大数据
数据皮皮侠AI5 小时前
上市公司股票名称相似度(1990-2025)
大数据·人工智能·笔记·区块链·能源·1024程序员节
Zoey的笔记本5 小时前
金融行业数据可视化平台:破解数据割裂与决策迟滞的系统性方案
大数据·信息可视化·数据分析
2501_933670795 小时前
大数据与财务管理专业就业岗位方向
大数据
小龙6 小时前
【Git 报错解决】本地分支与远程分支名称/提交历史不匹配
大数据·git·elasticsearch·github
Deepoch6 小时前
Deepoc具身模型:破解居家机器人“需求理解”难题
大数据·人工智能·机器人·具身模型·deepoc
代码方舟6 小时前
Java企业级实战:对接天远名下车辆数量查询API构建自动化风控中台
java·大数据·开发语言·自动化
AC赳赳老秦6 小时前
Python 爬虫进阶:DeepSeek 优化反爬策略与动态数据解析逻辑
开发语言·hadoop·spring boot·爬虫·python·postgresql·deepseek
roman_日积跬步-终至千里6 小时前
【大数据架构-数据中台(2)】数据中台建设与架构:从战略到落地的完整方法论
大数据·架构