mvn tomcat:run-war
But, what about debugging? Here I found two solutions.
Solution 1 : the standard mode
Just use :
mvnDebug tomcat:run-war
But it's a pre-configured solution and you should want to precise some specific options according to your environment.
Solution 2 : customize your debugging options
This is very simple.
- Ensure that you correctly declared your JAVA_HOME
- Set the debugging options which will be used by the JVM
For example :
export MAVEN_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"
Then, just start your server with mvn tomcat:run-war
2 commentaires:
And don't forget to connect with remote debugging eclipse configuration, or your server won't start because of the suspend=y
Note you can also debug tests executed with maven surfire with the same kind of trick, just adding:
-Dmaven.surefire.debug="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5000 -Xnoagent -Djava.compiler=NONE"
Here the suspend=y is more useful because since tests could be finished before you connected
Nice article , just to add I would suggest start up script to put JVM debug parameter and use a variable e.g. isDebugEnabled and also REMOTE_DEBUG_PORT in the script and export this variable when you want to remote debug your Java application. This will be very handy and will require just one time setup work.
Thanks
Javin
How to setup remote debugging in Eclipse
Post a Comment