Attach debugger to forked JUnit test in Ant
If you ever need to debug a JUnit test in a forked JVM and the tests are run from Ant then this tip might help you.
Add the snippet below to the JUnit Ant task and you can then attach a debugger to see what is going on.
<junit fork="yes">
<jvmarg value="-Xdebug" />
<jvmarg value="-Xnoagent" />
<jvmarg value="-Djava.compiler=NONE" />
<jvmarg value="-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y" />
....
</junit>
That will start the debugger on localhost:8787
Written by Greg Roodt
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Junit
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#