§Creating a New Application
Play expects a specific project structure. If you already have sbt installed, you can use a giter8 template, similar to a Maven archetype, to create a new Play project. This gives you the advantage of setting up your project folders, build structure, and development environment — all with one command.
In a command window, enter the following line to create a new project:
sbt new
In the interactive menu choose:
playframework/play-scala-seed.g8
for a Play Scala projectplayframework/play-java-seed.g8
for a Play Java project
Then respond to the prompts. After the template creates the project:
- Change into the top level project directory.
- Enter
sbt run
to download dependencies and start the system. - In a browser, enter http://localhost:9000/ to view the welcome page.
§Using the Java template directly instead
Enter:
sbt new playframework/play-java-seed.g8
To create a Play Java 2.9 project:
sbt new playframework/play-java-seed.g8 --branch 2.9.x
§Using the Scala template directly instead
Enter:
sbt new playframework/play-scala-seed.g8
To create a Play Scala 2.9 project:
sbt new playframework/play-scala-seed.g8 --branch 2.9.x
Besides replacing Akka with Pekko, Play 3.0 is identical to Play 2.9. If you don’t know what Akka or Pekko is, we recommend using Play 3.0. For more details on which version to use, read “How Play Deals with Akka’s License Change”.
Found an error in this documentation? The source code for this page can be found here. After reading the documentation guidelines, please feel free to contribute a pull request. Have questions or advice to share? Go to our community forums to start a conversation with the community.