-
Notifications
You must be signed in to change notification settings - Fork 0
NewApplication
The easiest way to create a new application is to use the play new command.
$ play new myFirstAppThis will ask for some information.
- The application name (just for display, this name will be used later in several messages).
- The template to use for this application. You can choose either a default Scala application, a default Java application, or an empty application.

Note that choosing a template at this point does not imply that you can’t change the main language later. For example, you can create a new application using the default Java application template and start adding Scala code at any point.
Once the application has been created you can use the play command again to enter the Play 2.0 console.
$ cd myFirstApp
$ playYou can also create a new Play application without installing Play, by using sbt.
First install sbt 0.11.2 if needed.
Just create a new directory for your new application and configure your sbt build script with two additions.
In project/plugins.sbt, add:
resolvers ++= Seq(
DefaultMavenRepository,
"Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/"
)
addSbtPlugin("play" % "sbt-plugin" % "2.0-RC1-SNAPSHOT")In project/Build.scala:
import sbt._
import Keys._
object ApplicationBuild extends Build {
val appName = "My first application"
val appVersion = "1.0"
val appDependencies = Nil
val main = PlayProject(appName, appVersion, appDependencies, mainLang = JAVA) //or mainLang = SCALA, it defaults to JAVA
}You can then launch the sbt console in this directory:
$ cd myFirstApp
$ sbtsbt will load your project and fetch the dependencies.