eclipse + maven + tomcat 调试
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2651404/
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
eclipse + maven + tomcat debugging
提问by Tom
I'm developping a web application in Eclipse and I'm using maven, spring and tomcat. Now the problem I have is that debug as => debug on server doesn't work. I just get exceptions. (and yes I've created the server)
我正在 Eclipse 中开发一个 web 应用程序,我正在使用 maven、spring 和 tomcat。现在我遇到的问题是 debug as => debug on server 不起作用。我只是得到例外。(是的,我已经创建了服务器)
If I use the mvn command to compile it, put the war in my tomcat webapps dir and start my tomcat the application works fine. But for the functionallity I'm now working on debugging would be usefull.
如果我使用 mvn 命令编译它,将 war 放在我的 tomcat webapps 目录中并启动我的 tomcat 应用程序工作正常。但是对于我现在正在调试的功能来说会很有用。
回答by user340202
I found the answer for this in http://Hymansonps4.me/wordpress/?p=868
我在http://Hymansonps4.me/wordpress/?p=868 中找到了答案
Worked like a charm for me, yet I don't understand anything!
对我来说就像一个魅力,但我什么都不明白!
回答by lexicore
We used to test our application with Tomcat as well, but switched to starting an embeddable Jetty. Here's a sample app. It's JSF, but it doesn't really matter. The pseudo-unit test simply starts a jetty "before" and shuts stops it "after". No need for external server infrastructure, no need for IDE dependencies.
我们曾经也用 Tomcat 测试我们的应用程序,但切换到启动一个可嵌入的 Jetty。这是一个示例应用程序。这是 JSF,但这并不重要。伪单元测试只是在“之前”启动一个码头并在“之后”关闭它。不需要外部服务器基础设施,不需要 IDE 依赖。
回答by arganzheng
you can run tomcat with maven with this command:
您可以使用以下命令使用 maven 运行 tomcat:
mvn tomcat:run
mvn tomcat:run
and if you want to debug, set this maven options:
如果要调试,请设置此 Maven 选项:
export MAVEN_OPTS=-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000
export MAVEN_OPTS=-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000
if you are in windows, use the set command:
如果您在 Windows 中,请使用 set 命令:
set MAVEN_OPTS=-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000
set MAVEN_OPTS=-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000
then you can debug with eclipse Remote Java Application
.
然后您可以使用 eclipse 进行调试Remote Java Application
。
Hope this help.
希望这有帮助。