You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

已配置代理仍有Maven依赖无法下载,需额外配置settings.xml吗?

解决Confluent Maven依赖代理下载失败的问题

结论

需要在settings.xml中进行额外配置——这两个依赖来自Confluent专属Maven仓库,当前代理未正确适配该仓库的访问需求。

错误信息翻译

[ERROR] 无法在项目Kafka-Testing上执行goal:无法解析org.jsmart:Kafka-Testing:jar:0.0.1-SNAPSHOT的依赖:以下构件无法解析:org.apache.kafka:kafka-streams:jar:7.3.2-ccs(缺失),io.confluent:kafka-schema-registry-client:jar:7.3.0(缺失):无法从/到confluent(http://packages.confluent.io/maven/)传输构件org.apache.kafka:kafka-streams:jar:7.3.2-ccs:连接重置

问题原因

连接重置报错说明当前代理无法正常转发对http://packages.confluent.io/maven/的请求,常见原因包括:

  • 现有代理仅配置了HTTPS协议,而Confluent仓库使用HTTP地址
  • 代理服务器禁止访问Confluent的域名
  • 代理配置未覆盖该仓库的域名范围

具体配置步骤

  1. 声明Confluent仓库
    在settings.xml的<profiles>节点下添加Confluent仓库配置:

    <profile>
      <id>confluent</id>
      <repositories>
        <repository>
          <id>confluent</id>
          <url>http://packages.confluent.io/maven/</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </repository>
      </repositories>
    </profile>
    

    同时激活该profile:

    <activeProfiles>
      <activeProfile>confluent</activeProfile>
    </activeProfiles>
    
  2. 适配代理规则
    根据代理支持的协议,添加或调整代理配置,确保能访问Confluent的HTTP仓库:

    <proxies>
      <proxy>
        <id>confluent-proxy</id>
        <active>true</active>
        <protocol>http</protocol>
        <host>你的代理地址</host>
        <port>代理端口</port>
        <nonProxyHosts>localhost|127.0.0.1</nonProxyHosts>
        <!-- 如需认证,取消下方注释并填写信息 -->
        <!-- <username>proxy-username</username> -->
        <!-- <password>proxy-password</password> -->
      </proxy>
    </proxies>
    

    若代理同时支持HTTP和HTTPS,可将<protocol>设为https,但需确认代理能处理HTTP请求转发。

  3. 验证配置
    执行Maven命令强制更新依赖,验证是否能正常下载:

    mvn clean install -U
    

额外排查点

  • 用curl -x 代理地址:端口 http://packages.confluent.io/maven/测试代理与Confluent仓库的连通性
  • 若公司网络有域名白名单,需将packages.confluent.io加入白名单

内容的提问来源于stack exchange,提问作者Glenn P

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.26 05:43:19