I found some articles on the internet and some discussions on google group, but they don't work any more.
How to do it with the latest play2-RC3 ?
By default, the Debug tool window opens when your program hits a breakpoint and is not hidden when the session is terminated. To change this behavior, clear the Show debug window on breakpoint checkbox on the Build, Execution, Deployment | Debugger page of the IDE settings Ctrl+Alt+S .
Generate configuration To debug, start your application with activator -jvm-debug 9999 run and in Eclipse right-click on the project and select Debug As, Debug Configurations. In the Debug Configurations dialog, right-click on Remote Java Application and select New. Change Port to 9999 and click Apply.
From the main menu, select Run | Debugging Actions | Smart Step Into or press Shift+F7 . Click the method. You can also select it using the arrow keys or tabs and press Enter / F7 .
You can start the play server in debug mode from console [docs], and should be able attach a debugger instance from Idea given that you know the port debugger is listening on.
I haven't use Idea so not sure if it is doable or not. It is fairly easy from netbeans. I suspect, it should be similar from Idea.
EDIT: They have also posted this in their customization guide for IDEs.
Debugging Play 2.x is very easy with IntelliJ IDEA 12.x, here are the steps you have to do:
Step 1. Enable the Play Framework Support plugin and the Play 2.0 Support plugin in File > Settings > Plugins.
The generic plugin usually comes with IntelliJ but make sure it's enabled. The Play 2.0 Support plugin can be downloaded by clicking Install Jetbrains plugin...
. Simply locate and install the plugin from the list, the latest working version for 12.x is v.0.2.49. (it may prompt that a Scala plugin needs to be installed aswell)
Step 2. Create a new Play app if you haven't or use an existing one
Step 3. Create a new Debug configuration: Run > Edit configurations...
You can click the +
icon in the top left corner to add a new configuration. Simply select Play 2 app
from the list and give the configuration a name. The default options should be correct but feel free to change them if necessary. When done, click Apply
and Ok
.
Step 4. Your toolbar should now have a Run icon and a Debug icon enabled.
Simply click the green arrow to run the Play application. This is the equivalent of doing play run
from the commandline (except without the commandline).
To debug, click the green bug, next the the arrow. This is the equivalent of doing play debug
from the commandline.
You will now be able to debug when a breakpoint is encountered.
Notes:
play clean-all
and play package
on the commandline, this should resolve most problems. If there are further problems, also try play idea
from the commandline.A video of these steps can also be found in this video by James Ward (start at around 1:40 min.).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With