Resolving import conflicts in Scala SBT

1.1k views Asked by At

I'm trying to following this tutorial, but I'm getting the same error for two days. i found some similar questions here in SO, but any of them helped me (maybe is because my lack of knowledge in scala and sbt).

Here is my build.sbt

name := "fitman"

version := "1.0"

scalaVersion := "2.11.6"

lazy val versions = new {
  val finatra = "2.1.2"
  val logback = "1.1.3"
}

resolvers ++= Seq(
  Resolver.sonatypeRepo("releases"),
  "Twitter Maven" at "https://maven.twttr.com"
)

libraryDependencies += "com.twitter.finatra" %% "finatra-http" % versions.finatra
libraryDependencies += "com.twitter.finatra" %% "finatra-slf4j" % versions.finatra
libraryDependencies += "ch.qos.logback" % "logback-classic" % versions.logback

Here is the warnings that I'm trying to understand:

SBT project import
                [warn] Scala version was updated by one of library dependencies:
                [warn]  * org.scala-lang:scala-library:(2.11.6, 2.11.4, 2.11.0, 2.11.2) -> 2.11.7
                [warn] To force scalaVersion, add the following:
                [warn]  ivyScala := ivyScala.value map { _.copy(overrideScalaVersion = true) }
                [warn] Run 'evicted' to see detailed eviction warnings
                [warn] Multiple dependencies with the same organization/name but different versions. To avoid conflict, pick one version:
                [warn]  * org.scala-lang:scala-library:(2.11.7, 2.11.6)
                [warn]  * org.scala-lang:scala-reflect:(2.11.7, 2.11.6)
                [warn]  * org.scala-lang.modules:scala-parser-combinators_2.11:(1.0.4, 1.0.3)
                [warn]  * org.scala-lang.modules:scala-xml_2.11:(1.0.5, 1.0.3)
1

There are 1 answers

3
HTNW On BEST ANSWER

One of the libraries you are using requires Scala 2.11.7, so SBT is overriding your scalaVersion setting with it. Update the version of Scala in your build file:

scalaVersion := "2.11.7"