/ intellij

play 1.x intellij idea

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.

  1. On the command line, use the play new command to create the Play project.
  2. On the command line, use the play idealize command to create an IntelliJ IDEA module.
  3. In IntelliJ IDEA, on the File menu, select Open Project… and select the generated .ipr file.

To add a run configuration:

  1. In IntelliJ IDEA, on the Run menu, select Edit Configurations.
  2. Right-click on Application under Defaults and select Add New Configuration.
  3. Under Main class, enter play.server.Server.
  4. Under VM parameters, enter -Dapplication.path=".".
  5. Under Working directory, enter the application path.
  6. Under Before launch, remove Make if exists.

To run Play in test mode in IntelliJ:

  1. Edit the run configuration and in VM parameters, append -Dplay.id=test.
  2. Right-click on your module and select Open Module Settings.
  3. Select the Dependencies tab.
  4. Click Add… and select Single-Entry Module Library.
  5. 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.