[フレーム]
Last Updated: February 25, 2016
·
5.408K
· groodt

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

AltStyle によって変換されたページ (->オリジナル) /