Search code examples
scalaintellij-ideaplayframework-2.1

How make Intellij Idea debug a Play 2.1 app's source code files, instead of project definition only


When I create a new Play 2.1 project, Intellij Idea insists on debugging the project configuration files only. That is, lines in ./project/Build.scala, and no other files.

How do I tell Idea to debug stuff in ./app/ instead?

I've generated Idea project files like so: [project-name] $ idea with-sources=yes (in Play's console).

(I cannot remember this ever happening before with Play 2.0 or earlier versions of 2.1)


Solution

  • There were 2 causes for this issue: one "interesting" and one stupid.

    The interesting cause:

    Play 2.1 and SBT seems to fork tests (and thus run them in a separate process). Therefore breakpoints in my unit test code were never hit.

    One way to "fix" this, is to add this config settinig:

    Keys.fork in Test := false
    

    The stupid cause:

    I had not yet compiled any "real" source code files in the new project. So therefore Idea never activated breakpoints on those lines. But the project configuration Build.scala file was compiled when I launched Play's SBT console I think, so Idea activated breakpoints in Build.scala directly. — So there was never a problem really: I just had to hit run in the Play console and then the breakpoints came alive (after Play had compiled my sources).