安装scala test libraryDependencies错误

时间:2017-05-14 17:50:56

标签: scala intellij-idea scalatest

当我在我的项目中使用Intellij Idea安装scala测试依赖项时,我收到以下错误

libraryDependencies += "org.scalatest" %% "scalatest" % "2.2.6" % "test"

错误:导入SBT项目时出错:
...

[warn] ==== public: tried
[warn]   https://repo1.maven.org/maven2/org/scalatest/scalatest_2.12/2.2.6/scalatest_2.12-2.2.6.pom
[info] Resolving org.scala-lang#scala-compiler;2.12.2 ...
[info] Resolving org.scala-lang#scala-reflect;2.12.2 ...
[info] Resolving org.scala-lang.modules#scala-xml_2.12;1.0.6 ...
[info] Resolving jline#jline;2.14.3 ...
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: org.scalatest#scalatest_2.12;2.2.6: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn]  Note: Unresolved dependencies path:
[warn]      org.scalatest:scalatest_2.12:2.2.6 (/Users/user/IdeaProjects/Example/build.sbt#L8-9)
[warn]        +- default:example_2.12:1.0
[trace] Stack trace suppressed: run 'last *:ssExtractProject' for the full output.
[trace] Stack trace suppressed: run 'last :update' for the full output.
[error] (:ssExtractProject) sbt.ResolveException: unresolved dependency: org.scalatest#scalatest_2.12;2.2.6: not found
[error] (*:update) sbt.ResolveException: unresolved dependency: org.scalatest#scalatest_2.12;2.2.6: not found
[error] Total time: 6 s, completed May 14, 2017 8:48:04 PM

请参阅完整的登录文件:/ Users / user / Library / Logs / IdeaIC2017.1 / sbt.last.log

我做错了什么?

3 个答案:

答案 0 :(得分:2)

2.2.6版与Scala 2.12不兼容,您应该使用latest available version(3.0.1)。

答案 1 :(得分:0)

这就是你想要的:

libraryDependencies += "org.scalatest" %% "scalatest" % "2.2.6" % Test

答案 2 :(得分:0)

我有同样的问题,这是由于使用了不支持的旧版本。 您应该使用较新版本的ScalaTest:

libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.4" % "test"