我尝试在以下位置运行 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
全期 here .
如何让 Kafka 流式处理示例正常工作?
最佳答案
Commands like mvn compile and mvn test on branch "kafka-0.10.0.0-cp-3.0.0" are supposed to "Work out of the box".
是的,他们确实这样做了——为此分支配置了一个 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 compile
在 master
上分支(这是默认分支)。只有 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
,自述文件包含有关如何构建最新 Kafka 版本的说明 0.10.1.0-SNAPSHOT
. Roger Hoover 提到了其中一个步骤,但分步说明位于 https://github.com/confluentinc/examples/tree/master/kafka-streams#apache-kafka。 .
顺便说一句,看起来您还修改了代码:
[INFO] Building foo-bar-baz-artifact 1.0-SNAPSHOT
“foo-bar-baz”不是代码库的一部分。因此,您可能需要还原这些更改,直到您拥有适合您的基本build设置。
编辑:为了它的值(value),我还更改了 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
.希望这对您有所帮助!
关于java - Confluent Kafka Streaming 示例不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38362081/