Skip to end of metadata
Go to start of metadata
See also the tutorial Getting Started with Scala.

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.

Starting with IntelliJ IDEA 14 EAP build, the Play 2.0 plugin is merged with the Scala plugin.

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.


Click Finish.

3. Check project settings

To make sure that project libraries are set up correctly, open FileProject 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.

See also the tutorial Getting Started with Scala.
Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Aug 07, 2014

    Anonymous

    Don't know what version of IDEA you are using for your illustrations but I'm using version 13.1.4, build #IU-135.1230, built on July 21, 2014, and the New Project dialog does NOT have a selection for project SDK.

    Thank you

    Gary

  2. Aug 15, 2014

    Anonymous

    I am using the same version and there is no selection for Project SDK and also once you create the application, the project folder is not marked with [Play2App build]. 

    1. Aug 15, 2014

      Absence of JDK selection is a bug, it will be fixed in the next nightly (i.e. tomorrow). As for mark, does the project dir have SBT icon? 

      1. Aug 18, 2014

        Anonymous

        Nope, the project folder was no marked with n SBT icon. This is what I had to do. I first created a Play 2.x application. I then deleted the .idea and .iml files/directories. The I imported the project using an SBT model and it marked project with an SBT icon and then I was able to Run the Application as a Play 2.x app.

        Another thing I noticed is that I can only create Scala based applications i.e. my Application class/object is always Application.scala. How can I get a Java based Play application i.e. Application.java?

        1. Sep 17, 2014

          Anonymous

          Thank you for your comment, I had the same issue! 

          Creating a new Play 2.0 project is buggy, it doesn't set anything correctly. You have to import the project as an SBT project. 

  3. Aug 18, 2014

    Anonymous

    "Play 2.x" doesn't appear as depicted in step (1). I checked that both Scala and Play 2 Support were enabled. I tried this on both Mac and Linux Mint without success.

  4. Aug 18, 2014

    Hi there,

    What version of IntelliJ IDEA are you using?

  5. Sep 02, 2014

    Anonymous

    After manually installing the latest Play plugin (0.41.2) from http://plugins.jetbrains.com/plugin/7080?pr= (copied it manually under plugins folder) it worked as described above.

    1. Sep 02, 2014

      Just to be clear: had to do this explicitly because the plugin installed by Intellij at this time did indeed lack the option described above. Maybe this will go away naturally when the plugin repo is resync-ed or something.

  6. Sep 18, 2014

    Anonymous

    Has the Play 2.0 Framework plug in been integrated into the Scala plugin? 

    I'm running OSX and Intellij 13.1 and the Play 2.0 Framework is now available under Browse Repositories. Installing manually results in the plug in being marked red.

    Using just the latest Scala plug in I do not get the Play 2.x option when creating new projects. Importing existing play projects doesn't pick up that it is a play project. 

    1. Sep 18, 2014

      Yes, the Scala and Play 2.0 plugins have been merged together, read the details at http://blog.jetbrains.com/scala/2014/09/17/scala-and-play-2-0-plugin-for-intellij-idea-14-eap-is-out/

      1. Oct 17, 2014

        Anonymous

        So why it's not working?

  7. Oct 04, 2014

    Anonymous

    I am using Intellij 13.1.5 build 135.1289, with java8 and scala 2.11.

    the play 2.0 plugin is marked as erroneous (red) and I can't figure out why.

    any ideas?

    Thanks,

    Alon Segal

    1. Oct 17, 2014

      Hello, 

      What plugin versions do you have? Red mark usually means that plugin versions are incompatible.

      Best Regards,

      Dmitry Naydanov

  8. Oct 11, 2014

    Anonymous

    Latest (139.1) build of EAP and latest (1.0.182.5.EAP) Scala plugin - can't see Play2 project, only SBT and non-SBT. Seems the merger didn't went very well?

    1. Oct 17, 2014

      Hello,

      do you use IDEA Ultimate? Also can you see Play2 project for java in corresponding section (among other frameworks)? 

      Best Regards, 

      Dmitry Naydanov

Add Comment