与Akka Http Spray Json一起用于SprayJsonSupport时,类路径中缺少'term akka.stream'

时间:2018-08-29 12:51:48

标签: akka akka-stream akka-http spray-json

我在我的项目中使用akka-http和reactmongo,并使用akka-http-spray-json封送/拆封案例类。这是它们的依赖项-

"com.typesafe.akka" %% "akka-http" % "10.1.3"
"com.typesafe.akka" %% "akka-stream" % "2.5.14"
"com.typesafe.akka" %% "akka-http-spray-json" % "10.1.3"
"org.reactivemongo" %% "reactivemongo" % "0.16.0"

我的代码在另一个我没有使用reactmongo的项目中运行良好。但是现在我遇到了错误-

[error] /home/ficode/project/ficode-sentinll/sentinll-common/src/main/scala/ficode/sentinll/common/model/CategoryManagement.scala:32:69: Symbol 'term akka.stream' is missing from the classpath.
[error] This symbol is required by 'method akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport.sprayJsonSourceReader'.
[error] Make sure that term stream is in your classpath and check for conflicting dependencies with `-Ylog-classpath`.
[error] A full rebuild may help if 'SprayJsonSupport.class' was compiled against an incompatible version of akka.
[error]   implicit val requestHeaderFormat = jsonFormat1(RequestHeader)
[error]                                                                     ^
[error] one error found

我也收到有关reactmongo和akka-stream中版本冲突的警告-

[warn] Found version conflict(s) in library dependencies; some are suspected to be binary incompatible:
[warn]  * com.typesafe.akka:akka-actor_2.11:2.5.14 is selected over 2.3.13
[warn]      +- com.typesafe.akka:akka-stream_2.11:2.5.14 ()       (depends on 2.5.14)
[warn]      +- org.reactivemongo:reactivemongo_2.11:0.16.0 ()     (depends on 2.3.13)
[warn] Run 'evicted' to see detailed eviction warnings

我试图从reactmongo中排除akka依赖项。警告消失了,但错误消失了。

任何想法我该如何解决?预先感谢。

1 个答案:

答案 0 :(得分:0)

尝试在SBT中添加替代吗?

dependencyOverrides ++= Set("com.typesafe.akka" % "akka-http-spray-json" % "10.1.3")