【问题标题】:Why can't SBT find the Play 2.1 plugin?为什么 SBT 找不到 Play 2.1 插件?
【发布时间】:2013-01-29 00:11:05
【问题描述】:

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

【问题讨论】:

    标签: sbt playframework-2.1


    【解决方案1】:

    问题是在 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/

    【讨论】:

      【解决方案2】:

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

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

      更改project/build.properties

      sbt.version=0.12.2
      

      【讨论】:

        猜你喜欢
        • 2019-06-06
        • 1970-01-01
        • 2012-11-29
        • 1970-01-01
        • 2015-03-18
        • 2021-05-16
        • 2014-08-04
        • 2013-02-04
        • 1970-01-01
        相关资源
        最近更新 更多