IntelliJ IDEA 11.1 Web Help

11.0+

You can import an existing Play! application into IntelliJ IDEA, whereupon IntelliJ IDEA recognizes Play!-specific directory structure and treats the application as IntelliJ IDEA module.

Note

IntelliJ IDEA does not support creation of Play! applications, you have to create them outside the IDE.

At the IntelliJ IDEA level, integration with Play! framework is provided through the Play! Support plugin. At the project level, you need to specify the path to the Play! framework installation.

In this section:

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:

  1. Dedicated console
  2. 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.
  3. Advanced facilities to search through the source code.
  4. Structure view.
To work on a Play! application in IntelliJ IDEA

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.

  1. From the root folder of your application, run the following command:
    play idea                    
                    

    A <application name>.iml file is generated in the application root folder.

  2. 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.

  3. When IntelliJ IDEA completes project creation, the Modules page of the Project Structure dialog box opens. Import your application as a module:
    1. Click the New toolbar button add, and then select Module on the context menu.
    2. 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 browseButton and select the module file in the dialog box that opens. Click Finish.

    The new one-module project opens in IntelliJ IDEA.

  4. To integrate the Play! framework with the IntelliJ IDEA, choose Tools | Play with Play framework on the main menu and specify the Play! installation directory in the dialog box that opens.
  5. As soon as the integration is enabled, IntelliJ IDEA opens the dedicated Play! console, where you can execute Play!-specific commands.
  6. View the results of executing Play! commands in the browser at the default URL address http://localhost:9000.

See Also

Concepts:

Procedures:

External Links:

Web Resources: