【问题标题】:Unresolved dependency SBT org.scala-sbt#sbt_2.9.1;0.12.1: not found, Play examples未解决的依赖 SBT org.scala-sbt#sbt_2.9.1;0.12.1:未找到,播放示例
【发布时间】:2012-11-24 03:30:30
【问题描述】:

我正在尝试在 Play 2.0 框架中运行示例,但是当我去运行“play”或“sbt”时。

当我进入目录“/samples/scala/helloworld”时,我执行“sbt”并获得:

    [info] Loading project definition from C:\src\Play20\samples\scala\helloworld\project
[warn]  module not found: play#sbt-plugin;2.0
[warn] ==== typesafe-ivy-releases: tried
[warn]   http://repo.typesafe.com/typesafe/ivy-releases/play/sbt-plugin/scala_2.9.2/sbt_0.12/2.0/ivys/ivy.xml
[warn] ==== sbt-plugin-releases: tried
[warn]   http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/play/sbt-plugin/scala_2.9.2/sbt_0.12/2.0/ivys/ivy.xml
[warn] ==== local: tried
[warn]   C:\Users\labra\.ivy2\local\play\sbt-plugin\scala_2.9.2\sbt_0.12\2.0\ivys\ivy.xml
[warn] ==== Typesafe repository: tried
[warn]   http://repo.typesafe.com/typesafe/releases/play/sbt-plugin_2.9.2_0.12/2.0/sbt-plugin-2.0.pom
[warn] ==== public: tried
[warn]   http://repo1.maven.org/maven2/play/sbt-plugin_2.9.2_0.12/2.0/sbt-plugin-2.0.pom
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: play#sbt-plugin;2.0: 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.0 (sbtVersion=0.12, scalaVersion=2.9.2)
[warn] 
sbt.ResolveException: unresolved dependency: play#sbt-plugin;2.0: not found
    at sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:214)
. . .

    at java.lang.Thread.run(Thread.java:722)
[error] (*:update) sbt.ResolveException: unresolved dependency: play#sbt-plugin;2.0: not found
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? 
[info] Loading project definition from C:\src\Play20\samples\scala\helloworld\project
[warn]  module not found: play#sbt-plugin;2.0
[warn] ==== typesafe-ivy-releases: tried
[warn]   http://repo.typesafe.com/typesafe/ivy-releases/play/sbt-plugin/scala_2.9.2/sbt_0.12/2.0/ivys/ivy.xml
[warn] ==== sbt-plugin-releases: tried
[warn]   http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/play/sbt-plugin/scala_2.9.2/sbt_0.12/2.0/ivys/ivy.xml
[warn] ==== local: tried
[warn]   C:\Users\labra\.ivy2\local\play\sbt-plugin\scala_2.9.2\sbt_0.12\2.0\ivys\ivy.xml
[warn] ==== Typesafe repository: tried
[warn]   http://repo.typesafe.com/typesafe/releases/play/sbt-plugin_2.9.2_0.12/2.0/sbt-plugin-2.0.pom
[warn] ==== public: tried
[warn]   http://repo1.maven.org/maven2/play/sbt-plugin_2.9.2_0.12/2.0/sbt-plugin-2.0.pom
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: play#sbt-plugin;2.0: 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.0 (sbtVersion=0.12, scalaVersion=2.9.2)
[warn] 
sbt.ResolveException: unresolved dependency: play#sbt-plugin;2.0: not found
    at sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:214)
    at sbt.IvyActions$$anonfun$update$1.apply(IvyActions.scala:122)
. . .
    at java.lang.Thread.run(Thread.java:722)
[error] (*:update) sbt.ResolveException: unresolved dependency: play#sbt-plugin;2.0: not found
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? q

我从http://www.scala-sbt.org/release/docs/Getting-Started/Setup安装了sbt 12.1版

我在这里注意到一个类似的问题:https://groups.google.com/forum/?fromgroups=#!topic/simple-build-tool/DGUbWsgZiLw

在答案中,它似乎与 SBT 的“Launcher”版本有关,我怎么知道我的 Launcher sbt 版本是哪个?我该如何更新它?

我也尝试从源代码编译 xsbt,但是在运行“sbt build-all”时,我得到:

    . . .
[info] Reading library jar [C:\compi\jdk\jre\lib\rt.jar]
[error] Error: Can't read [proguard.ClassPathEntry@73abdb5e] (Can't process class [com/oracle/net/Sdp$1.class] (Unsupported version number [51.0] for class format))
[error] java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: GC overhead limit exceeded
[error] Use 'last' for the full log.

但是,我的问题不是编译 xsbt,而是要知道如何执行“Play's examples”

在我获得的新文件夹中运行“sbt sbt-version”时:

[info] Set current project to default-85f41b (...)
[info] 0.12.1

【问题讨论】:

    标签: scala playframework-2.0 sbt


    【解决方案1】:

    如果您查看project/plugins.sbt,您会看到它需要设置play.version 系统属性:

    addSbtPlugin("play" % "sbt-plugin" % Option(System.getProperty("play.version")).getOrElse("2.0"))
    

    因此,您应该提供必要的play.version 属性

    $ sbt -Dplay.version=2.1-RC1
    

    或者干脆把plugins.sbt改成

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

    【讨论】:

    • 我做了,但它还没有工作。它返回: [info] Loading project definition from C:\src\Play20\samples\scala\helloworld\project [error] C:\src\Play20\samples\scala\helloworld\project\Build.scala:2: not found : object Keys [error] import Keys._ [error] ^ [error] 发现一个错误[error] (compile:compile) 编译失败
    • 只能建议清理项目重试。
    • 你的意思是执行“sbt clean”吗?因为我得到了同样的错误。我正在寻求一些帮助,我可以找到与 Scala 版本相关的东西,但我不确定这是否是问题所在。我的 scala 版本是 2.9.2。我应该如何清理项目并重试?
    • 我的意思是rm -rf Play20 && git clone git://github.com/playframework/Play20.git
    • 谢谢,但恐怕它还没有工作...同样的结果
    【解决方案2】:

    对于 Activator 1.0 用户

    在将项目加载到 Activator 1.0 之后将 Play 项目升级到更高版本时,您可能会遇到此问题。这是因为 Activator 在 /project 目录中创建了类似于 activator-...-shim.sbt 的文件。删除这些文件,Activator 应该会在您下次编译时解决问题。

    【讨论】:

    • 感谢您发布此信息。我花了几个小时试图弄清楚为什么我会出错,并在找到这个之前尝试了许多不同的 sbt/play 版本组合。
    【解决方案3】:

    切换到Play 2.1-RC1后问题解决了

    我还遇到了一些依赖项的问题,我解决了插入问题:

    // The Typesafe snapshots repository
    resolvers += "Typesafe Snapshots" at "http://repo.typesafe.com/typesafe/snapshots/"
    

    在 plugins.sbt 中

    我只是在关注:https://github.com/playframework/Play20/wiki/Repositories

    【讨论】:

      【解决方案4】:

      对于play 2.0.2,SBT 2.0.2 版在我的项目中运行良好。我将 plugins.sbt 文件中的 addSbtPlugin 行更改为:

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

      它应该与早期版本类似。正如 Labra 已经指出的那样,由于此版本的 SBT 不再是最新版本,您可能还需要添加以下解析器才能获得它:

      resolvers += "Typesafe Snapshots" at "http://repo.typesafe.com/typesafe/snapshots/"
      

      解决此类问题的另一种方法是尽可能将项目的 Play Framework 更新到最新版本。从长远来看,这可能是最好的选择,因为它可以让您的代码库保持最新。

      【讨论】:

        【解决方案5】:

        按照 Jose 的回答,我成功了,但使用了这个解析器:

        "Typesafe Snapshots" at "http://repo.typesafe.com/typesafe/maven-releases"
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2013-05-16
          • 1970-01-01
          • 2018-11-11
          • 2020-12-03
          • 2018-07-29
          • 2020-11-08
          • 2014-12-17
          • 2018-01-29
          相关资源
          最近更新 更多