Take the 2-minute tour ×


When I'm working with a Scala Play 2.0.4 application from within IntelliJ IDEA 12, I'm getting a lot of red syntax highlighting errors that don't show up as errors when I run the application from within Play! at the command line.


Are there others who are successfully running Scala Play 2.0 applications from within IntelliJ IDEA 12? If so, can you give me some suggestions as to how I might do this as well.


When I create a new project within IntelliJ, I set Play 2 home to ~/bin/opt/play-2.0.4, it creates the project and then a dialog box appears titled "Project Files Changed" which says that "Project file .../.idea/misc.xml has been changed externally. It is recommended to reload project for changes to take effect." If I ignore the prompt to reload the project, and I ctl-ins on app/, I get the following options:

  1. Java Class
  2. Scala Class
  3. File
  4. Package

I then create a package 'models', and a scala file 'Models.scala' with the code shown below, 'Hello' is syntax-highlighted as red and when I hover over the code, IDEA indicates that it can't find 'Hello' within the object MyDB:

package models

case class Hello(id: Int, name: String)

object MyDB {
  val hellos: List[Hello] = List(Hello(1, "Foo"), Hello(2, "Bar"))

I can now create create app/models/Models.scala with the code above and there are no highlighting errors. However, when I go to project settings -> Modules -> Dependencies, it says that 'sbt-and-plugins' has a broken path and "Module 'untitled': invalid item 'scala-2.9.1' in the dependencies list"

On the other hand, if I click 'ok' to reload the project for the changes to take effect, then if I I ctl-ins on app/, I get the following options:

  1. File
  2. Directory

This second option occurs also if I generate idea from within play at the command line (as well, with-sources), and also if I compile the project (either before or after I run idea).

As a further hint the app directory is colored blue if I don't reload the project, but once I reload it, then the app directory icon is brownish (like the others).

It is the same whether I use play-2.0.4 that I downloaded myself or whether I ask IntelliJ to download it when I create the new project. It also is the same whether I have the playframework with Play 2.0 Support or just the Play 2.0 Support by itself.

For further information, I'm running Arch Linux, Oracle Java 1.7.0_09, scala-2.9.1.final, Play 2.0.4, IntelliJ 12.0 IU-123.72. Plugins: Scala (0.6.371), Play 2.0 Support (0.1.86), Playframework Support (both with and without this, I get the same error).


Here's the stacktrace http://pastebin.com/uWEpv5Gd, which shows that IDEA throws an exception when creating the project, as follows:

[  87553]  ERROR - com.intellij.ide.IdeEventQueue - Error during dispatching of java.awt.event.InvocationEvent[INVOCATION_DEFAULT,runnable=com.intellij.openapi.progress.util.ProgressWindow$MyDialog$1@3b5a26d6,notifier=null,catchExceptions=false,when=1355073846201] on sun.awt.X11.XToolkit@1bd172ba
share|improve this question
You put big effort to describe your situation, but actually you didn't ask aby question. –  biesior Dec 9 '12 at 9:18
With pretty similar elements I can't reproduce your problems (on mac), sorry :/ maybe somebody else, will find the reason –  biesior Dec 9 '12 at 17:07
biesor: what jdk version and build and you running? My next idea is that it has to do with an incompatibility with 1.7.0_09 –  Alex Dec 9 '12 at 19:02
OpenJDK Runtime Environment (build 1.7.0-ea-b211), anyway I was also testing previous versions of Idea 12 (Leda) with Apple's 1.6.0 and I don't remember such problems as well –  biesior Dec 9 '12 at 19:13
add comment

2 Answers

up vote 1 down vote accepted

The problem was not the JVM, the problem is with the Play 2.0 plugin. I tested it with various JVMs in 1.7 and 1.6 and was still getting the same problem. I tried a fresh install of Intellij IDEA 12 by deleting the configuration directory, and it was doing the same thing. When I create a new project with IDEA 12, here's what the directory structure of target looks like:

[ambantis@okosmos target]$ tree
├── scala-2.9.1
│   └── cache
│       └── update
│           ├── inputs
│           └── output
└── streams
    └── $global
        ├── ivy-configuration
        │   └── $global
        │       └── out
        ├── ivy-sbt
        │   └── $global
        │       └── out
        ├── project-descriptors
        │   └── $global
        │       └── out
        └── update
            └── $global
                └── out

13 directories, 6 files

what's missing are /target/scala-2.9.1/classes and /target/scala-2.9.1/classes_managed. The solution is as follows:

After the build process, if you see a dialog box that says, "Project Files Changed", like this: enter image description here

do not click OK, instead escape. Then open the play console and compile the application. At this point it will work. You will only see errors that there are unused jar files, but otherwise everything will work fine.

share|improve this answer
add comment

I usually to the following to get Play projects running in IntelliJ 12:

  1. Create the project from the terminal with play new "projectname"
  2. Go into the new folder "projectname"
  3. Run play idea
  4. Open that folder with IntelliJ and enable syntax highlighting

Hope this helps

share|improve this answer
add comment

Your Answer


