Debugging Play 2.x is very easy in IntelliJ IDEA 12.x, here are the steps you should follow:
Step 1. Enable the Play Framework Support Plugin and Play 2.0 Support Plugin in the File> Preferences> Plugins menu.
The general plugin usually comes with IntelliJ, but make sure it is enabled. Play 2.0 Support Plugin can be downloaded by clicking Install Jetbrains plugin...
Just find and install the plugin from the list, the latest working version for 12.x is v.0.2.49 . (he may suggest that you need to install the Scala plugin)
Step 2. Create a new Play application if you donβt have one or use an existing one
Step 3. Create a new debug configuration: Run> Change Configurations ...
You can click the +
icon in the upper left corner to add a new configuration. Just select the Play 2 app
from the list and specify the name configuration. The default settings must be correct, but you can change them if necessary. When done, click Apply
and Ok
.
Step 4. Your toolbar should now have a Run icon and a Debug icon.
Just click the green arrow to launch the Play app. This is equivalent to executing a play run
from the command line (except without a command line).
To debug, click the green error, then the arrow. This is equivalent to executing a play debug
from the command line.
Now you can debug when a breakpoint is encountered.
Notes:
- Make sure that only one configuration is performed at a time, because Play does not like to run multiple instances at the same time.
- If you have problems compiling, run
play clean-all
and play package
on the command line, this should solve most problems. If there are additional problems, try play idea
from the command line. - Make sure that the playback configuration is loaded in the settings. You can do this by choosing File> Preferences> Playback Configuration.
A video of these steps can also be found in this video by James Ward (beginning at about 1:40 min.).
source share