解决Scala SBT中的导入冲突

时间:2016-12-22 19:58:06

标签: scala sbt finatra

我试图关注此tutorial,但我在两天内收到同样的错误。我在SO中发现了一些类似的问题,但是他们中的任何一个都帮助了我(可能是因为我对scala和sbt缺乏了解)。

这是我的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

以下是我试图了解的警告:

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 个答案:

答案 0 :(得分:3)

您使用的其中一个库需要使用Scala 2.11.7,因此SBT会覆盖您的scalaVersion设置。更新构建文件中的Scala版本:

scalaVersion := "2.11.7"