Play Framework
Let's look at the following common scenarios for generating a Play project in IntelliJ IDEA:
If you have an already existing Play project, you can import it or check out from version control. In this case you can follow the regular procedure for importing or cloning a project.
If you are not familiar with Play Framework and want to learn how to use it, create a Play project via IntelliJ IDEA that will generate an executable application.
If you want to manually add a support for Play Framework, create an sbt project.
Create a new Play project
Launch the New Project wizard. If no project is currently opened in IntelliJ IDEA, click New Project on the welcome screen. Otherwise, select from the main menu.
From the options on the left, under the Generators node, select Play 2.
Follow the steps suggested in the wizard and click Create.
IntelliJ IDEA generates the Play project with the appropriate structure, dependencies and an executable application.
Open an existing Play project
On the welcome screen, select Open. Alternatively, go to in the main menu.
In the dialog that opens, locate your project and if it is an sbt project, select the build.sbt file and click Open.
In the dialog that opens, click Open as Project.
IntelliJ IDEA opens the project and loads all the necessary dependencies.
If your project is not an sbt project, refer to the import project section.
Run and debug Play application
If you want to run the application:
In the project tool window, right-click the application.
In the context menu, select Run Play 2 App.
If you need to access the Run/Debug Configurations dialog:
Go to
.Click the
and select Play 2 App to create a new configuration.
Specify run/debug configuration settings. The default settings are enough for running and debugging purposes.
On the main toolbar, click the
icon to run or the
icon to debug your application.
You can check the output of your application in the default browser http://localhost:9000. If you want to stop the server session, press Alt+D (Cmd+P for macOS).
![A running Play application A running Play application](https://resources.jetbrains.com/help/img/idea/2024.2/play_server_display.png)
Work with Play settings
You can use Play settings to configure compiler options and configure formatting for route files. You can also view and edit a list of default template imports.
Press Ctrl+Alt+S and from the options on the left select
.Depending on what settings you want to configure, on the Play2 settings page, select the appropriate tab and adjust the settings. Use the Other tab to check and edit the list of template imports that get retrieved from the descriptor when you refresh your project.
To manually add a template, delete, or edit the existing ones, select the Select template imports manually option so the Imports section becomes active and adjust the list of imports accordingly.