当我在我的项目中使用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
我究竟做错了什么?
版本2.2.6与Scala 2.12不兼容,您应该使用latest available version(3.0.1)。
这就是你想要的:
libraryDependencies += "org.scalatest" %% "scalatest" % "2.2.6" % Test
我有同样的问题,这是由于使用较旧的不受支持的版本。你应该使用更新版本的ScalaTest:
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.4" % "test"