IntelliJ IDEA
Play provides a command to simplify IntelliJ IDEA configuration. To transform an existing application to a valid IntelliJ IDEA module, use the idealize command:
# play idealize myApp
To create a single module project, do the following in IntelliJ IDEA.
- On the command line, use the
play new
command to create the Play project. - On the command line, use the
play idealize
command to create an IntelliJ IDEA module. - In IntelliJ IDEA, on the File menu, select Open Project… and select the generated
.ipr
file.
To add a run configuration:
- In IntelliJ IDEA, on the Run menu, select Edit Configurations.
- Right-click on Application under Defaults and select Add New Configuration.
- Under Main class, enter
play.server.Server
. - Under VM parameters, enter
-Dapplication.path="."
. - Under Working directory, enter the application path.
- Under Before launch, remove
Make
if exists.
To run Play in test mode in IntelliJ:
- Edit the run configuration and in VM parameters, append -Dplay.id=test.
- Right-click on your module and select Open Module Settings.
- Select the Dependencies tab.
- Click Add… and select Single-Entry Module Library.
- Select
$PLAY_HOME/modules/testrunner/lib/play-testrunner.jar
and click OK.
Do not commit the .iml files when you work in a team!
The generated configuration files contains absolute references to your framework installation. These are specific to your own installation. When you work in a team on the same application, each developer must keep his IntelliJ IDEA configuration files private.