How to get Intellij Idea to debug Play 2.1 application source files, not just a project definition

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

How do I tell Idea to debug files in. / App / instead?

I created the Idea project files as follows: [project-name] $ idea with-sources=yes (in the Play console).

(I don't remember this happening before with Play 2.0 or earlier versions 2.1)

+4
source share
2 answers

There were two reasons for this problem: one "interesting" and one stupidity.

Interesting reason:

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

One way to “fix” this is to add this configuration:

 Keys.fork in Test := false 

Stupid reason:

I have not yet compiled any "real" source code files in a new project. Therefore, Idea never activated control points on these lines. But the configuration of the project. The build.scala file was compiled when I launched the Play SBT console, I think that's why Idea activated the breakpoints in Build.scala directly. “So there never was a problem: I just need to press run on the Play console, and then the breakpoints came to life (after Play collected my sources).”

+3
source

I start Intellij, with remote debugging on port 9999 1. ~ apatzer> play debug 2. Then run my remote configuration in Intellij 3. [playproject] $ run ==> Successfully hit breakpoints and debug.

Due to forking, I was unable to hit the breakpoints in any of my tests. For example: [playproject] $ test-only com.mydomain.pkg.MyTest ==> FIX another process. Breakpoints do not fall into the IDE.

Here's what worked:

 import sbt._ import Keys._ import play.Project._ object MyBuild extends Build { ... lazy val main = play.Project(appName, appVersion, appDependencies).settings( Keys.fork in testOnly := false, libraryDependencies ++= deps, ... 
0
source

All Articles