Here is my ANT JUnit target
You need to forget a moment that you can run JUnit tests and ANT targets from within Eclipse. What you want is to debug a Java application that happens to have the main class org.apache.tools.ant.Main
and which can be started with ant
from the command line.
You have now two options: You can create a launch config that invokes org.apache.tools.ant.Main
but that's pretty complicated to set up (you will have to replicate everything that the ant
script does at startup).
The other alternative is to configure ant
correctly. In your case, the tests run within the ant
process but I know no simple way to pass -Xdebug
to Ant itself. Therefore, you must run the tests in a new process. Add this to the junit
task:
Without this, jvmarg
parameters will be ignored.
The next step is to create a debug configuration in Eclipse. This article explains this in detail. For you, only the last part right before "Conclusion" is important.