Search code examples
scalasbtakkascalatest

Why does sbt give multiple dependencies warning with Akka and ScalaTest dependencies?


I've just added ScalaTest to build.sbt so it now looks as follows:

name := "appname"

version := "1.0"

scalaVersion := "2.11.7"

libraryDependencies ++= Seq(
  "com.typesafe.akka" %% "akka-actor" % "2.4.1",
  "org.scalatest" % "scalatest_2.11" % "2.2.4" % "test"
)

After that I am receiving the warning message:

SBT project import
         [warn] Multiple dependencies with the same organization/name but different versions. To avoid conflict, pick one version:
         [warn]  * org.scala-lang:scala-reflect:(2.11.2, 2.11.7)
         [warn]  * org.scala-lang.modules:scala-xml_2.11:(1.0.2, 1.0.4)

I also tried changing the line concerning ScalaTest into:

"org.scalatest" %% "scalatest" % "2.2.4" % "test"

but the warning still remains the same as above.

How could I deal with this issue since I haven't anywhere written "reflect" or "xml" in my project. I am using the newest version of both Akka and ScalaTest and Scala version 2.11.


Solution

  • The solution might be to add explicitly one of proposed versions by SBT. All warnings pass away when libraryDependencies is:

    libraryDependencies ++= Seq(
      "com.typesafe.akka" %% "akka-actor" % "2.4.1",
      "org.scalatest" %% "scalatest" % "2.2.4" % "test",
      "org.scala-lang" % "scala-reflect" % "2.11.7",
      "org.scala-lang.modules" %% "scala-xml" % "1.0.4"
    )