9

在我的plugins.sbt文件中,我有

scalaVersion := "2.10.0"

resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"

addSbtPlugin("play" % "sbt-plugin" % "2.1")  

当我尝试跑步时sbt,我得到了,除此之外

[warn] ==== Typesafe repository: tried
[warn]   http://repo.typesafe.com/typesafe/releases/play/sbt-plugin_2.10_0.12/2.1/sbt-        plugin-2.1.pom
[warn] ==== public: tried
[warn]   http://repo1.maven.org/maven2/play/sbt-plugin_2.10_0.12/2.1/sbt-plugin-2.1.pom
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: play#sbt-plugin;2.1: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn]  Note: Some unresolved dependencies have extra attributes.  Check that these         dependencies exist with the requested attributes.
[warn]          play:sbt-plugin:2.1 (sbtVersion=0.12, scalaVersion=2.10)
[warn]
sbt.ResolveException: unresolved dependency: play#sbt-plugin;2.1: not found

为什么 SBT 找不到插件?我也尝试addSbtPlugin("play" % "sbt-plugin" % "2.1-RC1")过类似的结果。

4

2 回答 2

5

问题是在 plugins.sbt 文件中包含 scalaVersion 设置。这会导致 sbt 在实际应该搜索 sbt-plugin_2.9.2_0.12 时在存储库中搜索 sbt-plugin_2.10.0_0.12。

我不确定在 plugins.sbt 文件中指定 scalaVersion 背后的语义,但它可能是在声明 SBT 正在运行的 Scala 版本。

这是 Play 2.1 sbt-plugin 文件的链接:http ://repo.typesafe.com/typesafe/simple/ivy-releases/play/sbt-plugin/scala_2.9.2/sbt_0.12/2.1-RC1/srcs /

于 2013-01-29T02:33:45.170 回答
1

根据文档,将其添加到您的project/plugins.sbt

addSbtPlugin("play" % "sbt-plugin" % "2.1.0")

更改project/build.properties

sbt.version=0.12.2
于 2013-02-06T13:37:09.767 回答