Debugging Play Applications in IntelliJ

Debugging Play applications in IntelliJ can be facilitated by instrumenting remote debugging.

Run your play application as usual and add -jvm-debug DEBUG_PORT to the sbt arguments:

sbt -jvm-debug 9999 run

Once your application is running, you can open a remote debugging connection in IntelliJ:

  1. Run -> Edit Configurations ...
  2. Add New Configuration
  3. Choose "Remote"
  4. All settings should be fine in this dialog, except for the port which needs to be the port you specified earlier (DEBUG_PORT), 9999 in my case
  5. Give the configuration a meaningful name
  6. OK
  7. You can now run "Debug" and choose the configuration you created above

At this point IntelliJ should state that the connection was successful, which means you can now go and set breakpoints and debug as usual.

I would expect the same to work for any other IDE as well.