使用简单构建工具(sbt)和IntelliJ调试Scala代码 [英] Debugging Scala code with simple-build-tool (sbt) and IntelliJ
问题描述
使用IntelliJ的内置调试器调试由sbt管理的Scala代码的最简单方法是什么?来自sbt的谷歌代码网站RunningSbt的文档列出了命令用于运行项目或测试的主类,但似乎没有调试命令。
What's the easiest way to debug Scala code managed by sbt using IntelliJ's built-in debugger? The documentation from "RunningSbt" from sbt's google code site lists commands for running the main class for a project or the tests, but there seem to be no commands for debugging.
后续问题:连接IntelliJ调试器的最简单方法是什么使用sbt的jetty-run命令时到Jetty?
Follow-up question: what's the easiest way to attach IntelliJ's debugger to Jetty when using sbt's jetty-run command?
推荐答案
对于IntelliJ中的普通调试,可以使用Application run / debug配置以通常的方式,无论你是否使用sbt来编译代码。
For ordinary debugging in IntelliJ, you can use an Application run/debug configuration in the usual way, regardless of whether you're using sbt to compile your code.
要连接到在Jetty中运行的应用程序,你需要创建一个Remote调试配置。执行此操作时,IntelliJ将为您提供一组用于运行远程JVM的命令行参数 - 类似于
To connect to your application running in Jetty, you'll need to create a Remote debug configuration. When you do so, IntelliJ will give you a set of command line arguments for running the remote JVM -- something like
-Xdebug -Xrunjdwp:transport = dt_socket,server = y,suspend = n,address = 5005
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005
使用这些参数启动sbt,然后执行 jetty-run
。最后,在IntelliJ中启动远程调试配置。 此主题可能有用。
Launch sbt with these arguments and then execute jetty-run
. Finally, launch your remote debug configuration in IntelliJ. This thread might be useful.
这篇关于使用简单构建工具(sbt)和IntelliJ调试Scala代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!