How to make the debugging in playframework in IntelliJ Idea
If its a play project, from the command line :
play debug
If its a SBT play project from the command line :
sbt -jvm-debug 9999 run
debug port is 9999 by default
now create a remote configuration
in IntelliJ :
Go to "edit run configurations"
Create a new remote configuration (port 9999, all other details leave with default values)
run the new debug configuration (don't forget to put a break point)
Most convenient way to run/debug applications in intellij IDEA is the following.
Menu command: Run -> Edit Configuration!
Add new configuration -> Application
Then fill up the fields:
Main class:
play.server.Server
VM Parameters:
-Dapplication.path=.
You should have something similar:
If you did it correctly, then you can run and stop your app right from IDE
EDIT for Play! 2
Play 2 has good documentation for debugging. So go read it. But if you want to investigate run/debug buttons method - read further.
It is different for Play 2.
Settings:
Main class:
play.core.server.NettyServer or play.core.server.ProdServerStart
VM Parameters:
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9999 -Dapplication.path=.
You still can debug your application by pressing debug button but I have not figured out some issues:
It always starts in PROD mode, so you can't make hot code changes.
RUNNING_PID. There is an error when you restart your debugging session saying that you have to delete this file.
In Play 2, simply do the following:
- From the shell, run
play debug
- You'll be dropped into the debug console. Type
run
and hit enter. - Then create a Remote configuration in IntelliJ IDEA set up for "localhost" and 9999.
- Start the new configuration