I have a SBT project
in this project i have a sub play project and other projects
example from my build file :
lazy val subProj1 = Project(id = "sub-proj-1", base = file("sub1"))
.settings(...)...
lazy val subProjPlay = play.Project("play-proj", 1.0 , path = file("web"))
need to debug the play server from IntelliJ IDEA.
To run the project I use sbt run
on the command line.
How can I debug the project in IDEA?
I found this to be the easiest solution : (using IntelliJ IDEA )
in IntelliJ :
Go to "edit run configurations"
Create a new remote configuration (port 9999, all other details leave with default values)
Go back to IntelliJ and run the new debug configuration (don't forget to put a break point)
From command line run :
sbt -jvm-debug 9999 run
The easiest solution.
Edit Configurations... -> add SBT Task
(not Remote
task).
Specify SBT Task: ~run
.
Run created SBT Task
using - Debug button
Provided you've Play distribution installed locally, use play debug run
on the command line and connect to localhost
on the port 9999
in IDEA.
From Debugging section in Using the Play console in the official Play 2.2.x documentation:
You can ask Play to start a JPDA debug port when starting the console. You can then connect using Java debugger. Use the play debug command to do that
If however you don't have it (and for a reason don't want to install it), add Remote
Run configuration in IDEA that will give you a hint for the command line arguments you should be using when launching SBT, e.g.
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005
When you launch SBT that may or may not be as simple as launching SBT jar, just use the above to configure JVM to run in debug mode.
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