Play/Scala Project

Creating a Play/Scala Project

Open a Terminal window and create a new project directory in your home directory.

mkdir play-scala-web-app

Browse to the new directory. Tip: you can type the first few letters in a directory followed by the Tab key.

cd play-scala-web-app

Initialize the new project with SBT.

sbt new playframework/play-scala-seed.g8

Wait for the downloads to complete.

Enter the following at the prompt:

  • Enter the name of the project: Play-Scala-Web-App
  • Organization name: enter a reverse of your domain. For example, io.linedrop.

Close Terminal.

Importing Play/Scala Project into IntelliJ IDEA

Launch IntelliJ IDEA.

Click Import Project.

Browse to your home directory and select play-scala-web-app.

Inside there will be another directory by the same name, this additional directory was created by SBT. It might seem silly to have a nested directory by the same name, but this structure will be helpful during the production deployment process. Keep it as is.

Select the nested play-scala-web-app directory.

Select build.sbt.

Click Open.

Click OK to confirm the default import settings.

Wait for the import process to complete.

Running the Project

Open Terminal and browse to the root of the project.

cd play-scala-web-app/play-scala-web-app

Run the project with SBT.

sbt run

Wait for the settings to load.

When Server started… message is printed in Terminal, open your browser and point to http://localhost:9000.

Wait for the project to compile.

Once you see Welcome To Play! in your browser, the project has been successfully loaded, compiled, and is running.

Stop the server by pressing ctrl+d in Terminal.


Next: Version Control