当前位置 : 主页 > 手机开发 > 其它 >

为什么sbt会使用Akka和ScalaTest依赖项给出多个依赖项警告?

来源:互联网 收集:自由互联 发布时间:2021-06-22
我刚刚将 ScalaTest添加到build.sbt中,所以它现在看起来如下: name := "appname"version := "1.0"scalaVersion := "2.11.7"libraryDependencies ++= Seq( "com.typesafe.akka" %% "akka-actor" % "2.4.1", "org.scalatest" % "scalatest_
我刚刚将 ScalaTest添加到build.sbt中,所以它现在看起来如下:

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

之后我收到了警告信息:

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)

我也尝试将有关ScalaTest的行更改为:

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

但警告仍然与上述相同.

我怎么能处理这个问题,因为我的项目中没有任何地方写过“反映”或“xml”.我使用的是Akka和ScalaTest以及Scala 2.11版本的最新版本.

解决方案可能是由SBT明确添加一个建议版本.当libraryDependencies为:时,所有警告都会消失:

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"
)
网友评论