为什么SBT找不到Play 2.1插件?

时间:2013-01-29 00:11:06

标签: sbt playframework-2.1

在我的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")类似的结果。

2 个答案:

答案 0 :(得分: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/

答案 1 :(得分:1)

根据文件, 在project/plugins.sbt

中添加此内容
addSbtPlugin("play" % "sbt-plugin" % "2.1.0")

更改project/build.properties

sbt.version=0.12.2