Maven invoked the JRE for running. So pass the debug parameters to MAVEN_OPTS in the environment.
MAVEN_OPTS=-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=3998,suspend=n,server=y -Xms256m -Xmx512m -XX:MaxPermSize=128m
With the option set in the cmd/shell, the process spits the debug information at socket 3998. This can be attached from the development environment like eclipse. The Xms, Xmx and XX:MaxPermSize parameter are memory parameters and you can ignore them if you are fine with the defaults.
These are in fact standard Java debugging options and nothing maven about it.
- address - Address of the port where you can attach the debugger
- suspend - Making it 'y' will suspend the java runtime and will wait fora client to listen to the socket for debugging information. Making it n does not suspends the server and will let the debugger to be attached at any time.