【发布时间】:2013-05-13 02:15:48
【问题描述】:
我从命令行运行 Jetty:
export GRADLE_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,address=9999,server=y,suspend=n"
gradle jettyRun
看看:
Listening for transport dt_socket at address: 9999
...然后在 IntelliJ Idea (Ultimate 12.1.3) 中创建一个具有所有默认值的新远程调试配置,仅将端口更改为 9999。
当我使用远程配置启动(调试)时,我看到:
Connected to the target VM, address: 'localhost:9999', transport: 'socket'
...这让我觉得一切都按预期进行。
然后我提出应该导致命中断点的请求。但是断点永远不会被触发。
我做错了什么?
谢谢。
【问题讨论】:
-
一个理论是我可能告诉 Gradle 而不是 Jetty 公开调试端口。并且查看 JettyRun 文档,可能没有办法做到这一点。 gradle.org/docs/current/dsl/… ... 使用 Cargo 插件寻找解决方案。但是查看 tomcat 插件,我正在做的事情看起来是正确的:github.com/bmuschko/gradle-tomcat-plugin
-
您的解决方案适合我。我正在使用 gradle 1.5。您上面的解决方案与stackoverflow.com/questions/9315398/…相同。
-
如果你看到 Connected to the target VM, address: 'localhost:9999', transport: 'socket' 表示你已连接。我将添加 system.out 以排除您没有触发断点
-
这应该可以正常工作。 Jetty 和 Gradle 在同一个 JVM 中运行。
标签: debugging intellij-idea jetty gradle remote-debugging