我已经在我的 ubuntu12 上从http://typesafe.com/stack/download安装了 typesafe-stack,然后我创建了一个 play 项目(g8 typesafehub/play-scala),现在我想将 scalatest 或 scalacheck 添加到我的项目中。
所以 my_app/project/plugins.sbt 有以下几行:
// The Typesafe repository
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
// Use the Play sbt plugin for Play projects
addSbtPlugin("play" % "sbt-plugin" % "2.0.1")
然后我使用 addSbtPlugin 添加了 scalatest:
addSbtPlugin("org.scalatest" %% "scalatest" % "2.0.M1" % "test")
现在当我运行'sbt test'时它失败并显示以下消息
[info] Resolving org.scalatest#scalatest;2.0.M1 ...
[warn] module not found: org.scalatest#scalatest;2.0.M1
[warn] ==== typesafe-ivy-releases: tried
[warn] http://repo.typesafe.com/typesafe/ivy-releases/org.scalatest/scalatest/scala_2.9.1/sbt_0.11.3/2.0.M1/ivys/ivy.xml
[warn] ==== local: tried
[warn] ~/.ivy2/local/org.scalatest/scalatest/scala_2.9.1/sbt_0.11.3/2.0.M1/ivys/ivy.xml
[warn] ==== Typesafe repository: tried
[warn] http://repo.typesafe.com/typesafe/releases/org/scalatest/scalatest_2.9.1_0.11.3/2.0.M1/scalatest-2.0.M1.pom
[warn] ==== typesafe-ivy-releases: tried
[warn] http://repo.typesafe.com/typesafe/ivy- releases/org.scalatest/scalatest/scala_2.9.1/sbt_0.11.3/2.0.M1/ivys/ivy.xml
[warn] ==== public: tried
[warn] http://repo1.maven.org/maven2/org/scalatest/scalatest_2.9.1_0.11.3/2.0.M1/scalatest-2.0.M1.pom
我不明白的是:为什么它使用这个http://repo.typesafe.com/typesafe/releases/org/scalatest/scalatest_2.9.1_0.11.3/2.0.M1/scalatest-2.0.M1.pom URL真正的http://repo.typesafe.com/typesafe/releases/org/scalatest/scalatest_2.9.1/2.0.M1/scalatest_2.9.1-2.0.M1.pom?
与 scalacheck 有完全相同的问题:它还尝试使用 sbt-version 特定的 artifactId 下载,而存储库只有 scala-version 特定的。
我究竟做错了什么?我知道 sbt 某处必须有一个开关,而不是使用 sbt-version 作为工件 URL 的一部分?
我也尝试在我的 plugins.sbt 中使用它
libraryDependencies += "org.scalatest" %% "scalatest" % "2.0.M1" % "test"
但看起来它被 sbt 完全忽略了,并且 scalatest.jar 没有出现在类路径中:
my_app/test/AppTest.scala:1: object scalatest is not a member of package org
[error] import org.scalatest.FunSuite
因为 sbt clean && sbt test 的输出有很多 Resolving org.easytesting#fest-util;1.1.6 或只是另一个库,但没有关于 scalatest。
我使用 scala 2.9.1 和 sbt 0.11.3,尝试使用 scalatest 2.0.M1 和 1.8;缩放检查:
resolvers ++= Seq(
"snapshots" at "http://oss.sonatype.org/content/repositories/snapshots",
"releases" at "http://oss.sonatype.org/content/repositories/releases"
)
libraryDependencies ++= Seq(
"org.scalacheck" %% "scalacheck" % "1.9" % "test"
)
具有相同的结果,即它使用不存在的 sbtVersion 特定的 POM URL。
我究竟做错了什么?谢谢。