我在我的项目中使用akka-http和reactivemongo以及使用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"
我的代码在另一个我没有使用reactivemongo的项目中正常工作。但现在我收到了错误 -
[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
我也收到有关reactivemongo和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
我试图从reactivemongo中排除akka依赖项。警告消失但不是错误。
知道怎么解决它?提前致谢。
尝试在SBT中添加覆盖?
dependencyOverrides ++= Set("com.typesafe.akka" % "akka-http-spray-json" % "10.1.3")