eclipse中的maven jetty调试问题 [英] maven jetty debugging issue in eclipse
问题描述
设置MAVEN_OPTS = - Xdebug -Xnoagent - Djava.compiler = NONE -Xrunjdwp:transport = dt_socket,address = 4000,server = y,suspend = n
mvn clean jetty:run
我正在pom文件中使用jetty-maven-plugin。
蝙蝠文件可以正常运行,并且没有错误。在eclipse内部,我创建了一个新的调试配置,选择了远程Java应用程序,我使用了4000端口和本地主机。
当我尝试运行调试配置,我总是得到这个错误:
无法连接到远程VM连接拒绝
拒绝连接:连接
有谁知道我如何解决这个问题?我检查了此答案,但没有帮助。
解决方案是在MAVEN_OPTS中将其更改为 suspend = y
而不是n 。然后,您执行 mvn jetty:run
命令,它会在Listing for transport dt_socket at address:4000行中暂停。之后,您运行eclipse调试器,它将附加到该进程。
如果使用suspend = n,它将无法正常工作(至少对我来说't)。
I am trying to debug a Maven jetty project in eclipse. I am staring jetty using "mvn clean jetty:run". Here's the complete bat file I'm using (I'm on windows).
set MAVEN_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=n"
mvn clean jetty:run
I am using the jetty-maven-plugin inside the pom file.
The bat file works ok and starts jetty without errors. Inside eclipse, I created a new debug configuration, chose "Remote Java Application" and I used 4000 for the port and localhost for the host.
When I try to run this debug configuration, I always get this error:
"Failed to connect to remote VM. Connection refused.
Connection refused: connect"
Does anyone know how I can solve this? I checked this answer, but it did not help.
The solution was that you have to change it to suspend=y
instead of n in the MAVEN_OPTS. Then you do the mvn jetty:run
command, and it will pause at the "Listening for transport dt_socket at address: 4000" line. After that, you run the eclipse debugger and it will attach to the process.
If you use suspend=n, it won't work (at least for me it didn't).
这篇关于eclipse中的maven jetty调试问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!