4

我尝试在以下位置运行 kafka-streams 示例:https ://github.com/confluentinc/examples/tree/master/kafka-streams

分支“kafka-0.10.0.0-cp-3.0.0”之类的命令应该是“开箱即用mvn compile” 。mvn test

在此处输入图像描述

我收到一条错误消息:

$ mvn compile
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building foo-bar-baz-artifact 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for org.apache.kafka:kafka-clients:jar:0.10.1.0-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for org.apache.kafka:kafka-streams:jar:0.10.1.0-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for org.apache.kafka:kafka_2.11:jar:test:0.10.1.0-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.941 s
[INFO] Finished at: 2016-07-13T17:31:33-04:00
[INFO] Final Memory: 10M/122M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project foo-bar-baz-artifact: Could not resolve dependencies for project foo-bar-baz-group:foo-bar-baz-artifact:jar:1.0-SNAPSHOT: The following artifacts could not be resolved: org.apache.kafka:kafka-clients:jar:0.10.1.0-SNAPSHOT, org.apache.kafka:kafka-streams:jar:0.10.1.0-SNAPSHOT: Failure to find org.apache.kafka:kafka-clients:jar:0.10.1.0-SNAPSHOT in http://packages.confluent.io/maven/ was cached in the local repository, resolution will not be reattempted until the update interval of confluent has elapsed or updates are forced -> [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

完整的问题在这里

如何让 Kafka 流式传输示例正常工作?

4

2 回答 2

3

分支“kafka-0.10.0.0-cp-3.0.0”上的 mvn compile 和 mvn test 等命令应该是“开箱即用”的。

是的,他们确实这样做了——为这个分支配置了一个 Travis CI 设置,可以在每次提交时验证构建。

[WARNING] The POM for org.apache.kafka:kafka-clients:jar:0.10.1.0-SNAPSHOT is missing, no dependency information available

看起来您实际上并没有使用,kafka-0.10.0.0-cp-3.0.0而是只是mvn compilemaster分支上运行(这是默认分支)。只有master分支使用 Kafka 版本0.10.1.0-SNAPSHOT(尚未发布),这就是为什么 - 如 README 中所述 - 如果您使用master.

您使用分支的工作流程kafka-0.10.0.0-cp-3.0.0应该是:

$ git clone https://github.com/confluentinc/examples.git

# Switch to `kafka-0.10.0.0-cp-3.0.0` branch
$ git checkout kafka-0.10.0.0-cp-3.0.0

$ cd examples/kafka-streams
$ mvn compile

注意:如果您确实想使用master,README 包含有关如何构建最新 Kafka 版本的说明0.10.1.0-SNAPSHOT。Roger Hoover 提到了其中一个步骤,但分步说明位于https://github.com/confluentinc/examples/tree/master/kafka-streams#apache-kafka

顺便说一句,看起来您还修改了代码:

[信息] 构建 foo-bar-baz-artifact 1.0-SNAPSHOT

“foo-bar-baz”不是代码库的一部分。因此,也许您需要恢复这些更改,直到您拥有适合您的基本构建设置。

编辑:为了它的价值,我还更改了https://github.com/confluentinc/examples的存储库设置以kafka-0.10.0.0-cp-3.0.0用作新的默认分支(之前master:),这样初学者就不会遇到与您相同的问题。这意味着,在运行之后git clone ...,您无需再运行git checkout kafka-0.10.0.0-cp-3.0.0即可切换到开箱即用的分支kafka-0.10.0.0-cp-3.0.0。希望这可以帮助!

于 2016-07-14T04:52:53.413 回答
2

在构建示例之前,您需要克隆Apache Kafka 的“主干”分支,构建并安装它。

./gradlew installAll
于 2016-07-14T00:14:54.177 回答