Java 如何在 Eclipse 中调试 Maven 项目?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20103107/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to debug a maven project in Eclipse?
提问by user3014213
I am trying to debug following maven project in Eclipse: https://code.google.com/p/cloudscale/
我正在尝试在 Eclipse 中调试以下 Maven 项目:https: //code.google.com/p/cloudscale/
I followed the instructions of RickHigh (found here https://stackoverflow.com/a/19986408/3014213) and when I write mvnDebug exec:exec in Terminal the lines
我按照 RickHigh 的说明(在此处找到https://stackoverflow.com/a/19986408/3014213),当我在终端中编写 mvnDebug exec:exec 时,行
Preparing to Execute Maven in Debug Mode
Listening for transport dt_socket at address: 8000
appears and after starting the Remote Java Application in Eclipse, the project is started BUT it does not hold on breakpoints...
出现并在 Eclipse 中启动远程 Java 应用程序后,该项目已启动,但它不保留断点...
Any ideas, what could go wrong?
任何想法,可能会出什么问题?
回答by mirelon
The debugger may be connected to the wrong JVM - not the one created by exec:exec
. Try remote debugging like here: https://stackoverflow.com/a/22367089/1878731
调试器可能连接到错误的 JVM - 不是由exec:exec
. 尝试远程调试,如下所示:https: //stackoverflow.com/a/22367089/1878731
回答by Eugene Kuleshov
When you install m2e pluginin Eclipse, it will show you a link in Console view to automatically connect debugger (i.e. create remote debugger launch configuration) to your process when it spills "Listening for transport dt_socket at address: 8000" message to the console. So, your debugger is basically one click away.
当您在 Eclipse 中安装m2e 插件时,它会在控制台视图中向您显示一个链接,以便在将“侦听传输 dt_socket at address: 8000”消息溢出到控制台时自动将调试器(即创建远程调试器启动配置)连接到您的进程。因此,您的调试器基本上只需单击一下即可。