I'm trying to build a project using Scala 2.12.3, sbt 0.13.6, and the following library dependencies in my build.sbt file:
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-actor" % "2.5.4",
"com.typesafe.akka" %% "akka-stream" % "2.5.4",
"com.typesafe.akka" %% "akka-stream-testkit" % "2.5.4" % Test,
"com.typesafe.akka" %% "akka-http" % "10.0.9",
"com.typesafe.akka" %% "akka-http-core" % "10.0.9",
"org.scalatest" %% "scalatest" % "3.0.1" % Test)
However, I keep getting the following warning about version conflicts...It appears that akka-http
has a transitive dependency on Akka / Streams version 2.4.19. I found a recent similar post , which advises to explicitly add akka-streams as a dependency and make sure it's the same version as akka-actor. Here are the dependency warnings:
[warn] Found version conflict(s) in library dependencies; some are
suspected to be binary incompatible:
[warn]
[warn] * com.typesafe.akka:akka-stream_2.12:2.5.4 is selected over
2.4.19
[warn] +- com.typesafe.akka:akka-http-core_2.12:10.0.9
(depends on 2.4.19)
[warn] +- com.werner.opttech:dependency-test_2.12:0.0.0
(depends on 2.4.19)
[warn]
[warn] * com.typesafe.akka:akka-actor_2.12:2.5.4 is selected over
2.4.19
[warn] +- com.werner.opttech:dependency-test_2.12:0.0.0
(depends on 2.5.4)
[warn] +- com.typesafe.akka:akka-stream_2.12:2.5.4
(depends on 2.5.4)
[warn] +- com.typesafe.akka:akka-parsing_2.12:10.0.9
(depends on 2.4.19)
Any advice on how to resolve this error, so that I can use the latest versions of akka, akka streams, and akka http? Thanks!
Your configuration is correct, as it follows the compatibility guidelines that you mentioned. I think you're misinterpreting the warning messages as errors; you are using the 2.5.4 version of those libraries. Take a closer look at this snippet:
[warn] * com.typesafe.akka:akka-actor_2.12:2.5.4 is selected over 2.4.19
sbt is indeed picking version 2.5.4 of the akka-actor
library instead of version 2.4.19.
Also, running show update
in the sbt console outputs the following:
[info] com.typesafe.akka:akka-actor_2.12
[info] - 2.5.4
[info] status: release
[info] publicationDate: Thu Aug 10 09:17:00 EDT 2017
....
[info] - 2.4.19
[info] evicted: true
[info] evictedData: latest-revision
sbt evicted version 2.4.19 of akka-actor
in favor of version 2.5.4.
The warning messages actually confirm that you're working with the current version of the Akka tools.
chunjef's answer is correct.If you want to clear the warning indeed,add the following code to your build.sbt.
conflictManager := ConflictManager.strict
dependencyOverrides += "com.typesafe.akka" %% "akka-actor" % "2.5.4"
dependencyOverrides += "com.typesafe.akka" %% "akka-stream" % "2.5.4"
dependencyOverrides += "org.scala-lang" % "scala-library" % "2.12.3"
Kind of related: akka-http 10.1.0-RC1 removes the transient dependency :
we changed the policy not to depend on
akka-stream
explicitly any more but mark it as aprovided
dependency in our build. That means that you will have to always add a manual dependency toakka-stream
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.