我正在尝试将Kafka添加到Play应用程序中(使用Typesafe Activator版本1.3.2)。
下面我列出了我的build.sbt
文件。我复制了如何从Kafka's FAQ
build.sbt
name := """Test"""
version := "1.0-SNAPSHOT"
lazy val root = (project in file(".")).enablePlugins(PlayJava)
scalaVersion := "2.11.6"
libraryDependencies ++= Seq(
javaJdbc,
javaEbean,
cache,
javaWs
)
resolvers += "Apache repo" at "https://repository.apache.org/content/repositories/releases"
libraryDependencies ++= Seq(
jdbc,
anorm,
cache,
"joda-time" % "joda-time" % "2.2",
"org.joda" % "joda-convert" % "1.3.1",
"ch.qos.logback" % "logback-classic" % "1.0.13",
"org.mashupbots.socko" % "socko-webserver_2.9.2" % "0.2.2",
"nl.grons" % "metrics-scala_2.9.2" % "3.0.0",
"com.codahale.metrics" % "metrics-core" % "3.0.0",
"io.backchat.jerkson" % "jerkson_2.9.2" % "0.7.0",
"com.amazonaws" % "aws-java-sdk" % "1.3.8",
"net.databinder.dispatch" %% "dispatch-core" % "0.11.2",
"org.apache.kafka" % "kafka_2.9.2" % "0.8.2.1" excludeAll (
ExclusionRule(organization = "com.sun.jdmk"),
ExclusionRule(organization = "com.sun.jmx"),
ExclusionRule(organization = "javax.jms"),
ExclusionRule(organization = "org.slf4j")
)
)
编译时我收到以下错误:
[error] com.typesafe.akka:akka-actor _2.11, <none>
[error] com.typesafe.akka:akka-slf4j _2.11, <none>
[trace] Stack trace suppressed: run last *:update for the full output.
[error] (*:update) Conflicting cross-version suffixes in: com.typesafe.akka:akka-actor, com.typesafe.akka:akka-slf4j
答案 0 :(得分:2)
看起来wiki已经过时了,特别是对于基于scala的依赖项,并没有使用sbt的%%
表示法。
当你有一个Scala 2.11.1项目时,我切换到使用%%
而不是显式scala版本,并且还更新了所有依赖项(一些旧版本没有Scala 2.11的版本)。 / p>
尝试使用这些依赖项:
libraryDependencies ++= Seq(
jdbc,
anorm,
cache,
"joda-time" % "joda-time" % "2.7",
"org.joda" % "joda-convert" % "1.7",
"ch.qos.logback" % "logback-classic" % "1.1.3",
"org.mashupbots.socko" %% "socko-webserver" % "0.6.0",
"nl.grons" %% "metrics-scala" % "3.4.0_a2.3",
"io.dropwizard.metrics" % "metrics-core" % "3.1.1",
"com.gilt" %% "jerkson" % "0.6.7",
"com.amazonaws" % "aws-java-sdk" % "1.9.30",
"net.databinder.dispatch" %% "dispatch-core" % "0.11.2",
"org.apache.kafka" %% "kafka" % "0.8.2.1" excludeAll (
ExclusionRule(organization = "com.sun.jdmk"),
ExclusionRule(organization = "com.sun.jmx"),
ExclusionRule(organization = "javax.jms"),
ExclusionRule(organization = "org.slf4j")
)
)