1. Create play application with project wizard
Before you create a project make sure that Scala and Play Framework version 2.0 plugins are enabled in IntelliJ IDEA.
Open Project Wizard, select Play 2.x in Scala section and click Next.
On the next page of the wizard, specify your project's information and click Finish.
The IDE will create an empty application.
2. Import play project
IntelliJ IDEA lets you import an existing Play project.
Open Project Wizard and select Import Project.
You can also use main menu and select File→ Import Project.
In the window that opens, select a file that you want to import and click OK.
On the first page of the wizard, select Import project from external model option, choose SBT project from the list and click Next.
On the next page of the wizard, you can select the following options:
- Use auto-import -select this check box to resolve all the changes made to the project automatically every time you refresh your project.
- Create directories for empty content roots automatically - select this option to add a src directory to your project. When you import a project the scr directory is not created. When you create a project, the src directory is generated automatically.
3. Check project settings
To make sure that project libraries are set up correctly, open File→ Project Structure and check if module dependencies are resolved without warnings.
Since we use Scala for our application, also ensure that Compiler library is set in Scala facet settings.
4. Use code assistance features
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.
5. Run play app
You can run Play application and check the output in your default browser.
6. Debug play application
You can easily start a debugger session. You can use default configurations' settings and simply click OK.