Documentation

§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:

Then respond to the prompts. After the template creates the project:

  1. Change into the top level project directory.
  2. Enter sbt run to download dependencies and start the system.
  3. 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”.

Next: Anatomy of a Play application


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.