IntelliJ IDEA 2017.3 Help

Getting Started with Play 2.x

The following is only valid when Scala Plugin is installed and enabled!

Creating a project

Before you create a project make sure that the Scala plugin is downloaded and enabled in IntelliJ IDEA.

  1. If no project is currently open in IntelliJ IDEA, click Create New Project on the Welcome screen. Otherwise, select File | New | Project.

    As a result, the New Project wizard opens.

  2. In the left-hand pane, select Scala.
    Note that for creating a Java project with the Play 2.x framework, you need to select Java.
  3. In the right-hand pane, select Play 2.x.
    You can also select Scala for creating a project with the Scala module, SBT for creating a project with the SBT module Activator for creating a project with Typesafe Activator templates or Dotty for creating a project with the Dotty SDK.
    play new project
    Click Next.
  4. On the next page of the wizard, specify project and module location settings.
    Play new wizard page
    Click Finish. The IDE will create an empty application.
    play project window

Importing a Play 2.x project

IntelliJ IDEA lets you import an existing Play 2.x project.

  1. On the main menu, select File | New | Project from Existing Sources.
  2. In the window that opens, select a file that you want to import and click OK. The Import project wizard opens.
  3. On the first page of the wizard, select Import project from external model option and choose SBT project from the list. Click Next.
    sbt import project
  4. On the next page of the wizard, select SBT options and click Finish.
    sbt project wizard import

Checking project settings

  1. On the main menu, select File | Project Structure. Alternatively, use projectStructure icon on the Toolbar.
  2. In the Project Structure dialog, check if module dependencies are resolved without warnings.
    play project structure
    Also,ensure that the Scala compiler library is set.
    play project structure2

Using code assistance

When everything is set up, you can use code completion, navigation and on-the-fly code analysis features in your Play files. IntelliJ IDEA also supports code assistance for routes files and code inspections.

play coding assistance

Running a Play 2.x application

  1. In the project tool window, right-click the application.
  2. On the context menu, select Run Play 2 App.
    play run app

Debugging a Play 2.x application

  1. On the main menu, select Run | Debug.
  2. From the list that opens, select Edit Configurations.
  3. In the dialog that opens, specify settings for debugging or use the default ones and press OK. IntelliJ IDEA will start a debugging session.
    play debug app
Last modified: 6 March 2018