Reputation: 361
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?
Upvotes: 19
Views: 16489
Reputation: 1570
The easiest solution.
Edit Configurations... -> add SBT Task
(not Remote
task).
Specify SBT Task: ~run
.
Run created SBT Task
using - Debug button
Upvotes: 13
Reputation: 4609
IntelliJ IDEA 2016.1.1 && Play Framework 2.5.3
For me, no matter how I set(create new Run/Debug Configuration for Play 2 App or SBT Task, specify the debug port, execute in Run or Debug mode) in the IntelliJ IDEA 2016.1.1 Enterprise Edtion, the IDEA can not open the debug port(default 9999), so the debug is impossible.
After disable the sbt-fork-run-plugin(comment it in /project/paly-fork-run.sbt), it works!!!
I am newer to Play framework,and have found many bugs...Compare to RoR, it's so hard to learn, to run, to use, to debug...
Below is my steps:
activator -jvm-debug 9999 "run 11111"
(I use port 9999 to debug, port 11111 to run my Play project)Upvotes: 1
Reputation: 74599
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.
Upvotes: 2
Reputation: 9913
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
Upvotes: 35