Scala sbt: Multiple dependencies in sbt

Eason Caizhen Liu picture Eason Caizhen Liu · Dec 26, 2015 · Viewed 14.9k times · Source

I am a new user to Scala, following the way to create a scala sbt project.

https://www.youtube.com/watch?v=Ok7gYD1VbNw


After adding

libraryDependencies += "org.scalatest" % "scalatest_2.11" % "2.2.4" % "test"

to build.sbt, and refreshed the project, I got this msg.

[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)

And in build.sbt, thw word 'scalatest' is red that means it's an unsolved dependencies.

Should I change something in Project Setting, like scala sdk?

Best Regard!

Answer

Bartłomiej Szałach picture Bartłomiej Szałach · Jan 2, 2016

You could regard adding those dependencies:

libraryDependencies ++= Seq(
  "org.scala-lang" % "scala-reflect" % "2.11.7",
  "org.scala-lang.modules" % "scala-xml_2.11" % "1.0.4"
)

It forces compiler to choose concrete version of libraries. It solves problem for me.