I have found maven plugin to start tomcat.
Do Maven have any plugin to start Tomcat in debug mode?
If you're using Eclipse and you're running Maven externally (not using M2Eclipse) then you can use whatever command line command you usually use but use mvnDebug
instead of mvn
.
As an example, I run the tomcat plugin under the "run"
profile so my normal command is:
mvn clean install -Prun
This uses the <maven-dir>/bin/mvn
script but to run in debug mode, simply substitute <maven-dir>/bin/mvnDebug
in.
mvnDebug clean install -Prun
If mvnDebug
isn't on your PATH then you might have to use the full path to it (or create a link from a directory on your path, like /usr/bin
, to it), e.g:
/path/to/maven-dir/mvnDebug clean install -Prun
I'm using maven 3.0.5 and the mvnDebug
script comes out of the box. If you look inside it then you'll see it basically does what Titi Wangsa Bin Damhore says, but you'll note that suspend=y
is used so the JVM waits for you to connect your debugger before continuing:
MAVEN_DEBUG_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"
This may or may not be what you want.
mvn clean tomcat7:run
with the correct MAVEN_DEBUG_OPTS
allows you to connect as a 'Remote' debugging session in IntelliJ.
Apr 30, 2014 at 10:31
we can cheat. use java opts
in *IX
export JAVA_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1044"
then run your maven, it should go to debug mode