就像 Testkit Error with Ambigous Version Error
Akka Testkit Error with Ambigous Version Error
我正在使用 Akka testkit 库来测试我的几个演员。
这是我 build.sbt 中的内容:
"com.typesafe.akka" %% "akka-testkit" % "2.6.10" % Test,
这是我得到的错误:
java.lang.IllegalStateException: You are using version 2.6.10 of Akka, but it appears you (perhaps indirectly) also depend on older versions of related artifacts. You can solve this by adding an explicit dependency on version 2.6.10 of the [akka-actor-typed, akka-slf4j, akka-protobuf-v3, akka-stream, akka-serialization-jackson] artifacts to your project. See also: https://doc.akka.io/docs/akka/current/common/binary-compatibility-rules.html#mixed-versioning-is-not-allowed
我很困惑,因为我对 Akka 没有任何其他依赖项,因为这里是我 build.sbt 中定义的所有依赖项:
libraryDependencies ++= Seq(
ws,
// Our streaming library
"io.monix" %% "monix" % "3.3.0",
// Dependencies needed for Slick
"com.typesafe.slick" %% "slick" % "3.3.3",
"com.typesafe.slick" %% "slick-hikaricp" % "3.3.3",
// For application Metrics
"io.dropwizard.metrics" % "metrics-core" % "4.1.16",
"io.dropwizard.metrics" % "metrics-jvm" % "4.1.16",
"com.typesafe.scala-logging" %% "scala-logging" % "3.9.2",
"org.scala-lang.modules" % "scala-async_2.11" % "0.9.7",
"com.typesafe" % "config" % "1.4.1",
// For JSON parsing
"com.typesafe.play" %% "play-json" % "2.9.1",
"com.typesafe.play" %% "play-json-joda" % "2.9.1",
// JDBC driver for MySQL & H2
"mysql" % "mysql-connector-java" % "8.0.22",
"com.h2database" % "h2" % "1.4.186",
// Test dependencies
"com.typesafe.akka" %% "akka-testkit" % "2.6.10" % Test,
"org.scalatest" %% "scalatest" % "3.2.3" % Test,
"org.awaitility" % "awaitility" % "4.0.3" % Test,
"org.scalatestplus.play" %% "scalatestplus-play" % "5.1.0" % Test exclude ("org.slf4j", "slf4j-simple"),
"com.github.andyglow" %% "websocket-scala-client" % "0.3.0" % Test exclude ("org.slf4j", "slf4j-simple")
)
有解决此问题的想法吗?
所以我不得不像这样为 Akka 添加一些依赖项:
"com.typesafe.akka" %% "akka-testkit" % AkkaVersion % Test,
"com.typesafe.akka" %% "akka-slf4j" % AkkaVersion % Test,
"com.typesafe.akka" %% "akka-protobuf-v3" % AkkaVersion % Test,
"com.typesafe.akka" %% "akka-serialization-jackson" % AkkaVersion % Test,
"com.typesafe.akka" %% "akka-stream" % AkkaVersion % Test,
"com.typesafe.akka" %% "akka-actor-typed" % AkkaVersion % Test,
我的 AkkaVersion 是 2.6.10
不得不提及这些依赖关系看起来很难看,但这是我能够摆脱错误的方式。
我正在使用 Akka testkit 库来测试我的几个演员。
这是我 build.sbt 中的内容:
"com.typesafe.akka" %% "akka-testkit" % "2.6.10" % Test,
这是我得到的错误:
java.lang.IllegalStateException: You are using version 2.6.10 of Akka, but it appears you (perhaps indirectly) also depend on older versions of related artifacts. You can solve this by adding an explicit dependency on version 2.6.10 of the [akka-actor-typed, akka-slf4j, akka-protobuf-v3, akka-stream, akka-serialization-jackson] artifacts to your project. See also: https://doc.akka.io/docs/akka/current/common/binary-compatibility-rules.html#mixed-versioning-is-not-allowed
我很困惑,因为我对 Akka 没有任何其他依赖项,因为这里是我 build.sbt 中定义的所有依赖项:
libraryDependencies ++= Seq(
ws,
// Our streaming library
"io.monix" %% "monix" % "3.3.0",
// Dependencies needed for Slick
"com.typesafe.slick" %% "slick" % "3.3.3",
"com.typesafe.slick" %% "slick-hikaricp" % "3.3.3",
// For application Metrics
"io.dropwizard.metrics" % "metrics-core" % "4.1.16",
"io.dropwizard.metrics" % "metrics-jvm" % "4.1.16",
"com.typesafe.scala-logging" %% "scala-logging" % "3.9.2",
"org.scala-lang.modules" % "scala-async_2.11" % "0.9.7",
"com.typesafe" % "config" % "1.4.1",
// For JSON parsing
"com.typesafe.play" %% "play-json" % "2.9.1",
"com.typesafe.play" %% "play-json-joda" % "2.9.1",
// JDBC driver for MySQL & H2
"mysql" % "mysql-connector-java" % "8.0.22",
"com.h2database" % "h2" % "1.4.186",
// Test dependencies
"com.typesafe.akka" %% "akka-testkit" % "2.6.10" % Test,
"org.scalatest" %% "scalatest" % "3.2.3" % Test,
"org.awaitility" % "awaitility" % "4.0.3" % Test,
"org.scalatestplus.play" %% "scalatestplus-play" % "5.1.0" % Test exclude ("org.slf4j", "slf4j-simple"),
"com.github.andyglow" %% "websocket-scala-client" % "0.3.0" % Test exclude ("org.slf4j", "slf4j-simple")
)
有解决此问题的想法吗?
所以我不得不像这样为 Akka 添加一些依赖项:
"com.typesafe.akka" %% "akka-testkit" % AkkaVersion % Test,
"com.typesafe.akka" %% "akka-slf4j" % AkkaVersion % Test,
"com.typesafe.akka" %% "akka-protobuf-v3" % AkkaVersion % Test,
"com.typesafe.akka" %% "akka-serialization-jackson" % AkkaVersion % Test,
"com.typesafe.akka" %% "akka-stream" % AkkaVersion % Test,
"com.typesafe.akka" %% "akka-actor-typed" % AkkaVersion % Test,
我的 AkkaVersion 是 2.6.10
不得不提及这些依赖关系看起来很难看,但这是我能够摆脱错误的方式。