How to debug Play application using activator

playframework-2.0typesafe-activator

I know that for the classic Play framework it's play debug ~run. I tried running activator debug ~run but I get the following error:

[error] Not a valid command: debug (similar: idea)
[error] Not a valid project ID: debug
[error] Expected ':' (if selecting a configuration)
[error] Not a valid key: debug (similar: debianSign, node)
[error] debug
[error]      ^

What am I doing wrong?

Best Answer

If you're just doing activator ~run, then you should be able to pass a JVM debug port option with:

./activator -jvm-debug <port> ~run

This may not do the same thing as play-run, but here's the arguments it's adding to the command line:

-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=<port>

From: https://github.com/typesafehub/activator/blob/master/dist/src/templates/activator#L107

I've successfully attached to this process in my IDE.

If you're running in windows, the automatic configuration is a bit different. With the latest activator, you can do the following:

  1. Open %UserProfile%\.activator\activatorconfig.txt (The UserProfile is different depending on your windows install. Mine is C:\Documents and Settings\jsuereth on one installation and C:\Users\jsuereth on another). Past the following in the file: -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=<PUT YOUR PORT HERE>
  2. You can set the JAVA_OPTS property on the command line before starting activator, e.g. set "JAVA_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=<port>"

Hope that helps!

Related Topic