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

Maven构建Spring Boot项目时无法找到Confluent Kafka Avro序列化器及Schema Registry Client依赖

Maven构建Spring Boot项目时无法找到Confluent Kafka Avro序列化器及Schema Registry Client依赖

你遇到的这个问题很常见,原因是Confluent官方的Kafka相关依赖(包括Avro序列化器、Schema Registry客户端)并不托管在Maven中央仓库,所以默认只配置了中央仓库的话,Maven肯定找不到这些包。

你遇到的具体错误信息如下:

Could not find artifact io.confluent:kafka-schema-registry-client:pom:7.8.0 in central

你当前的依赖配置是这样的:

<!-- https://mvnrepository.com/artifact/io.confluent/kafka-avro-serializer -->
<dependency>
    <groupId>io.confluent</groupId>
    <artifactId>kafka-avro-serializer</artifactId>
    <version>7.8.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.confluent/kafka-schema-registry-client -->
<dependency>
    <groupId>io.confluent</groupId>
    <artifactId>kafka-schema-registry-client</artifactId>
    <version>7.8.0</version>
</dependency>

解决方案:添加Confluent专属Maven仓库

你只需要在pom.xml中添加Confluent官方的Maven仓库配置,就能让Maven找到这些依赖了,具体步骤如下:

  1. 在pom.xml的<project>标签内,添加<repositories>节点配置Confluent仓库:
<repositories>
    <repository>
        <id>confluent</id>
        <url>https://packages.confluent.io/maven/</url>
    </repository>
</repositories>
  1. (可选)如果你的项目需要用到Confluent的Maven插件,还可以补充添加<pluginRepositories>节点:
<pluginRepositories>
    <pluginRepository>
        <id>confluent</id>
        <url>https://packages.confluent.io/maven/</url>
    </pluginRepository>
</pluginRepositories>
  1. 配置完成后,重新执行Maven构建命令(mvn clean install),就能成功拉取到所需的依赖了。

另外需要注意:Confluent的版本号需要和你项目中使用的Kafka版本兼容,7.8.0版本对应的Kafka版本是3.8.0,如果版本不匹配可能会出现兼容性问题,这点也需要留意哦。

备注:内容来源于stack exchange,提问作者Chandima Maduwantha

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.04.14 09:43:08