未解决的依赖关系SBT org.scala-sbt#sbt_2.9.1; 0.12.1:未找到,播放示例

时间:2012-12-06 06:09:34

标签: scala playframework-2.0 sbt

我正在尝试在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的“启动器”版本有关,我怎么知道我的启动器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的例子”

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

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

4 个答案:

答案 0 :(得分:6)

如果查看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")

答案 1 :(得分:4)

对于Activator 1.0用户

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

答案 2 :(得分:1)

对于播放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更新为最新版本(如果可能)。从长远来看,这可能是最佳选择,因为它可以让您保持代码库的最新状态。

答案 3 :(得分:0)

在Jose的回答之后,我使用了这个解析器:

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