2

我已按照此文档使用 sbt 创建了一个新的 Play 应用程序 myFirstApp。我有一个build.sbtmyFirstApp 文件夹和一个plugins.sbtinmyFirstApp/project文件夹。

但是,我在sbt从 myFirstApp 执行时收到以下错误,

~/ScalaWorkspace/myFirstApp/build.sbt:7: error: not found: value playScalaSettings
playScalaSettings
^
[error] Type error in expression
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? i
[warn] Ignoring load failure: no project loaded.

我该如何解决这个问题?

更新1:得到这个错误:

[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: play#routes-compiler_2.9.2;2.1.1: not found
[warn]  :: play#templates-compiler_2.9.2;2.1.1: not found
[warn]  :: play#console_2.9.2;2.1.1: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::              FAILED DOWNLOADS            ::
[warn]  :: ^ see resolution messages for details  ^ ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: play#sbt-link;2.1.1!sbt-link.jar
[warn]  :: play#play-exceptions;2.1.1!play-exceptions.jar
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
sbt.ResolveException: unresolved dependency: play#routes-compiler_2.9.2;2.1.1: not found
unresolved dependency: play#templates-compiler_2.9.2;2.1.1: not found
unresolved dependency: play#console_2.9.2;2.1.1: not found
download failed: play#sbt-link;2.1.1!sbt-link.jar
download failed: play#play-exceptions;2.1.1!play-exceptions.jar
4

1 回答 1

3

那是我的第一个sbt以 Play 为中心的开发,如果解决方案不符合可接受的质量标准,请多多包涵。

我按照文档创建新应用程序中未安装 Play的情况下创建新应用程序部分进行操作,最后得到以下文件。

build.sbt如文档中所述。

import play.Project._

name := "My first application"

version := "1.0"

playScalaSettings

然后我创建project/build.properties了它,因为它是具有可重复构建的推荐方法 - sbt 的版本是已知和固定的。

sbt.version=0.13.0

我修改project/plugins.sbt为如下:

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

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

// Use the Play sbt plugin for Play projects
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.0-RC2")

使用项目中的文件,我可以执行sbt并获得项目的提示。

jacek:~/sandbox/myFirstApp
$ sbt
[info] Loading global plugins from /Users/jacek/.sbt/0.13/plugins
[info] Loading project definition from /Users/jacek/sandbox/myFirstApp/project
[info] Set current project to My first application (in build file:/Users/jacek/sandbox/myFirstApp/)
[My first application] $ run
...lots of [SUCCESSFUL ]'s

--- (Running the application from SBT, auto-reloading is enabled) ---

[info] play - Listening for HTTP on /0:0:0:0:0:0:0:0:9000

(Server started, use Ctrl+D to stop and go back to the console...)
于 2013-09-16T22:26:45.683 回答