Spark Streaming与Kafka 2.0.0依赖项

时间:2016-09-15 17:26:15

标签: apache-spark sbt spark-streaming spark-streaming-kafka

我尝试使用spark-streaming2.0.0尝试使用kafka 0.8主题,我试图确定我在build.sbt文件中尝试使用这些依赖项所需的依赖项

libraryDependencies += "org.apache.spark" %% "spark-streaming_2.11" % "2.0.0"

当我运行sbt包时,我得到所有这三个罐子的未解决的依赖关系,

但这些罐子确实存在

https://mvnrepository.com/artifact/org.apache.spark/spark-streaming-kafka-0-8_2.11/2.0.0

请帮忙调试此问题,我是Scala的新手,所以如果我没有做对,请告诉我

1 个答案:

答案 0 :(得分:12)

问题是您使用%%指定Scala版本,它会尝试推断您正在使用的Scala版本。

删除一个%

libraryDependencies += "org.apache.spark" % "spark-core_2.11" % "2.0.0"
libraryDependencies += "org.apache.spark" % "spark-streaming_2.11" % "2.0.0"
libraryDependencies += "org.apache.spark" % "spark-streaming-kafka-0-8_2.11" % "2.0.0"

或删除Scala版本:

libraryDependencies += "org.apache.spark" %% "spark-core" % "2.0.0"
libraryDependencies += "org.apache.spark" %% "spark-streaming" % "2.0.0"
libraryDependencies += "org.apache.spark" %% "spark-streaming-kafka-0-8" % "2.0.0"