Playframework 无法使用sbt创建Play framework web应用程序?
我使用sbt创建了一个新的播放应用程序myFirstApp。我在myFirstApp文件夹中有一个Playframework 无法使用sbt创建Play framework web应用程序?,playframework,sbt,Playframework,Sbt,我使用sbt创建了一个新的播放应用程序myFirstApp。我在myFirstApp文件夹中有一个build.sbt,在myFirstApp/project文件夹中有一个plugins.sbt 但是,我在从myFirstApp执行sbt时遇到以下错误 ~/ScalaWorkspace/myFirstApp/build.sbt:7: error: not found: value playScalaSettings playScalaSettings ^ [error] Type error in
build.sbt
,在myFirstApp/project
文件夹中有一个plugins.sbt
但是,我在从myFirstApp执行sbt
时遇到以下错误
~/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
这是我第一次以
sbt
为中心的游戏开发,如果解决方案不符合可接受的质量标准,请耐心等待
我按照文档中的创建一个新的应用程序而没有安装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...)
我注意到你使用play#…2.9.2;。。。因此它与我在回复中提供的内容不同-您应该在
addSbtPlugin
中使用com.typesafe.play
。版本2.9.2
也是一个警告标志,表明您正在使用另一个版本的Scala-请确保您使用sbt 0.13.0.Jacek,仔细检查后,我注意到我使用的是sbt 0.12.3。在使用sbt 0.13.0进行尝试时,它成功了。谢谢。