I've followed this documentation to create a new Play application, myFirstApp, using sbt. I've a build.sbt
in the myFirstApp folder and a plugins.sbt
in myFirstApp/project
folder.
However, I'm getting the following error on executing sbt
from 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.
How do I solve this problem?
UPDATE 1: Getting this error:
[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
That was my first sbt
-centric Play development so bear with me if the solution doesn't meet acceptable quality standards.
I followed the section Create a new application without having Play installed in the document Creating a new application and ended up with the following files.
build.sbt
is as described in the document.
import play.Project._
name := "My first application"
version := "1.0"
playScalaSettings
I then created project/build.properties
as it's a recommended approach to have reproducible builds - the version of sbt is known and fixed.
sbt.version=0.13.0
I modified project/plugins.sbt
to be as follows:
// 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")
With the files in the project, I could execute sbt
and have the project's prompt.
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...)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.