我正在尝试学习如何使用SBT以及我发现的以下简单示例未能找到scalatest的版本:
name := "DoingItWrong"
version := "0.0.1"
scalaVersion := "2.10.1"
libraryDependencies ++= Seq (
"org.scalatest" %% "scalatest" % "1.9.1" % "test"
)
我在尝试sbt之前使用了maven,以下依赖项工作正常:
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_2.10</artifactId>
<version>1.9.1</version>
</dependency>
我尝试运行SBT时得到以下输出:
$ sbt package
[info] Loading global plugins from /home/rafael/.sbt/plugins
[info] Set current project to DoingItWrong (in build file:/home/rafael/Dev/DoingItWrong/)
[info] Updating {file:/home/rafael/Dev/DoingItWrong/}default-c52ace...
[info] Resolving org.scala-lang#scala-library;2.10.1 ...
[info] Resolving org.scalatest#scalatest_2.10.1;1.9.1 ...
[warn] module not found: org.scalatest#scalatest_2.10.1;1.9.1
[warn] ==== local: tried
[warn] /home/rafael/.ivy2/local/org.scalatest/scalatest_2.10.1/1.9.1/ivys/ivy.xml
[warn] ==== Sonatype snapshots: tried
[warn] http://oss.sonatype.org/content/repositories/snapshots/org/scalatest/scalatest_2.10.1/1.9.1/scalatest_2.10.1-1.9.1.pom
[warn] ==== public: tried
[warn] http://repo1.maven.org/maven2/org/scalatest/scalatest_2.10.1/1.9.1/scalatest_2.10.1-1.9.1.pom
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: org.scalatest#scalatest_2.10.1;1.9.1: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[error] {file:/home/rafael/Dev/DoingItWrong/}default-c52ace/*:update: sbt.ResolveException: unresolved dependency: org.scalatest#scalatest_2.10.1;1.9.1: not found
[error] Total time: 1 s, completed Jun 6, 2013 9:45:49 AM
我是否缺少某些存储库或其他东西?
我还尝试了scalaVersion := "2.10.0"
和2.10.0-M4
。通过SBT scalatest for Scala 2.10的最新可用版本是什么?
答案 0 :(得分:8)
为了确保它不是潜在的SBT项目的配置问题,请暂时不要使用%%
表示法。实际上,这个版本会自动选择与您当前的scala版本相对应的Jar版本,这可能与您期望的版本不同(在您的conf中疏忽,某些配置文件中的变量冲突等等)。
首选此选项以隔离“错误”上下文:
libraryDependencies += "org.scalatest" % "scalatest_2.10" % "1.9.1" % "test"
我刚尝试过,效果很好。