需要用到Confluent
kafka-avro-serializer
Maven神器。从 official guide 我应该将这个存储库添加到我的 Maven pom
<repository>
<id>confluent</id>
<url>http://packages.confluent.io/maven/</url>
</repository>
问题是 URL http://packages.confluent.io/maven/ 目前似乎不起作用,因为我得到以下回复
<Error>
<Code>NoSuchKey</Code>
<Message>The specified key does not exist.</Message>
<Key>maven/</Key>
<RequestId>15E287D11E5D4DFA</RequestId>
<HostId>
QVr9lCF0y3SrQoa1Z0jDWtmxD3eJz1gAEdivauojVJ+Bexb2gB6JsMpnXc+JjF95i082hgSLJSM=
</HostId>
</Error>
其实Maven并没有找到神器
<dependency>
<groupId>io.confluent</groupId>
<artifactId>kafka-avro-serializer</artifactId>
<version>3.1.1</version>
</dependency>
你知道问题是什么吗? 谢谢
需要在 pom.xml 中添加 confluent 存储库
请在 pom.xml 中添加以下行
<repositories>
<repository>
<id>confluent</id>
<url>https://packages.confluent.io/maven/</url>
</repository>
</repositories>
该文件可用,因为您可以直接访问它来下载它: http://packages.confluent.io/maven/io/confluent/kafka-avro-serializer/3.1.1/kafka-avro-serializer-3.1.1.jar
您可以尝试在 Maven 命令中添加 -U 标志以强制下载缓存文件。
repo 的根目录不可浏览,这就是为什么您在浏览到 http://packages.confluent.io/maven/
时收到消息的原因就像你一样,我使用公司存储库(Sonatype Nexus)并且无法代理 confluent 的存储库。
然后我更改了我的 maven settings.xml 以从镜像存储库中排除融合:
<mirrors>
<mirror>
<id>nexus</id>
<mirrorOf>*,!confluent</mirrorOf> <!-- mirror anything but confluent as Nexus cannot proxy it -->
<url>repository.company.local/nexus/content/groups/public</url>
</mirror>
</mirrors>
...
<repositories>
...
<repository>
<id>confluent</id>
<url>http://packages.confluent.io/maven/</url>
</repository>
</repositories>
这样,工件解析也适用于合流的工件。
不像代理 repo 那样简洁,但至少比手动下载和注册每个依赖项更简单。
seams jar 文件从 http url 中删除或 http url 不工作。 https 网址对我有用。
<repositories>
<repository>
<id>confluent</id>
<url>https://packages.confluent.io/maven/</url>
</repository>
您可以在 Maven 设置文件中添加一个镜像,以从 confluent repo 中获取 jars 以及 repository config 。 需要改变的是 在settings.xml中添加镜像
<mirror>
<id>confluent</id>
<mirrorOf>confluent</mirrorOf>
<name>Nexus public mirror</name>
<url>http://packages.confluent.io/maven/</url>
</mirror>
在 Maven 设置的存储库部分添加这个
<repository>
<id>confluent</id>
<url>http://packages.confluent.io/maven/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
尝试将 Artifactory 连接到 Confluent Maven 存储库时,您必须将 Artifactory 中的 repo URL 设置为
http://packages.confluent.io/maven
或 https://packages.confluent.io/maven
(这两种方案似乎都可以正常工作)。令人困惑的部分是,当您要求 Artifactory 测试该 URL 时,它将失败并显示消息“输入可能不为空”。您也无法浏览 Artifactory 中的存储库。然而,不管这些问题如何,当客户端请求它们时,工件将被下载和缓存。
在 Maven 项目的 POM 文件中添加融合存储库。
在 SBT 项目的 build.sbt 中使用下面
resolvers += "confluent" at "https://packages.confluent.io/maven/"
有问题:
<repositories>
<repository>
<id>confluent</id>
<url>http://packages.confluent.io/maven/</url>
</repository>
</repositories>
工作:
<repositories>
<repository>
<id>confluent</id>
<url>https://packages.confluent.io/maven/</url>
</repository>
</repositories>
将“http”更改为“https”对我有用,因为 maven 出于安全原因阻止了 HTTP。