Prerequisites
Note
Before you start, make sure the following prerequisites are met:
-
Play! is downloaded
and installed on your computer.
- The Play! Support plugin is enabled. This plugin is bundled with IntelliJ IDEA and activated by default. If it is not, enable the plugin.
- You have a Play! application on your machine.
Play! support
Play! support includes:
- Dedicated console
-
Coding assistance:
- Navigation between the methods of <application>.java and the corresponding templates.
- Updating templates through the variables of the corresponding Application.java methods.
- Code completion for keywords, labels, variables, parameters and functions.
- Error and syntax highlighting.
- Code formatting and folding.
- Advanced facilities to search through the source code.
- Structure view.
In general, the strategy is as follows: we have the framework generate an .iml module file that defines the application structure as if it were a IntelliJ IDEA module, and then import the application into a project as a module.
-
From the root folder of your application, run the following command:
play ideaA <application name>.iml file is generated in the application root folder.
-
Start IntelliJ IDEA and create an empty Java project from scratch in the root folder of your Play! application.
To get an empty project, just clear the Create module check box.
Tip
We do not need a module originally, because the application itself will be arranged as module.
-
When IntelliJ IDEA completes project creation, the Modules page of the Project Structure dialog box opens.
Import your application as a module:
-
Click the New toolbar button
, and then select Module on the context menu.
-
On the first page of the Add Module wizard, choose the Import existing module option
and specify the path to the <application name>.iml module file.
Type the path manually or click the Browse button
and select the module file in the dialog box that opens.
Click Finish.
The new one-module project opens in IntelliJ IDEA.
-
Click the New toolbar button
- To integrate the Play! framework with the IntelliJ IDEA, choose on the main menu and specify the Play! installation directory in the dialog box that opens.
- As soon as the integration is enabled, IntelliJ IDEA opens the dedicated Play! console, where you can execute Play!-specific commands.
- View the results of executing Play! commands in the browser at the default URL address http://localhost:9000.
