Can you debug an sbt build in IntelliJ

I have an sbt build that is giving me some problems. is there a way to debug it in IntelliJ?

1 comment

Sure. You can connect to an sbt process like any other jvm with jdwp debugging by adding jvm args when starting sbt:

sbt -J-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005

and creating an IntelliJ "Remote" run config to connect to that process. If the problems are in a forked process, instead add the jdwp options to the `javaOptions` in sbt. For example:

fork in run := true
javaOptions in run += "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005"

Please sign in to leave a comment.