如何在调试模式下使用maven启动tomcat

时间:2013-08-18 18:55:00

标签: maven tomcat maven-plugin

我找到了maven plugin来启动tomcat。

Maven是否有任何插件可以在调试模式下启动Tomcat?

2 个答案:

答案 0 :(得分:17)

如果你正在使用Eclipse并且你在外部运行Maven(不使用M2Eclipse),那么你可以使用你经常使用的任何命令行命令但是使用mvnDebug而不是mvn

举个例子,我在"run"个人资料下运行tomcat插件,所以我的正常命令是:

    mvn clean install -Prun

这使用<maven-dir>/bin/mvn脚本,但要在调试模式下运行,只需替换<maven-dir>/bin/mvnDebug

    mvnDebug clean install -Prun

如果您的PATH上没有mvnDebug,那么您可能必须使用它的完整路径(或者从路径上的目录创建链接,如/usr/bin),例如:

    /path/to/maven-dir/mvnDebug clean install -Prun

我正在使用maven 3.0.5并且mvnDebug脚本开箱即用。如果你查看它,那么你会看到它基本上做了 Titi Wangsa Bin Damhore 所说的,但你会注意到suspend=y被使用,所以JVM等你连接你的调试器继续之前:

    MAVEN_DEBUG_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"

这可能是您想要的也可能不是。

答案 1 :(得分:1)

我们可以作弊。 使用java opts

in *IX
export JAVA_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1044"

然后运行你的maven, 它应该进入调试模式

相关问题