Eduard, in a new post on his blog, provides a solution to debugging a complex ant task in Eclipse. Although convention asks you to start ant in debug mode and then connect to the vm with a remote debug session from Eclipse, Eduard has an alternative method that is more direct and simple.
He recommends taking the following steps:
Run the build file at least once so that a run configuration is created in the 'External tools' section
Open the 'External tools' configuration screen
On the JRE tab, add -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 to the vm arguments.
Run this external tool configuration
Create a new ‘Remote Java Application’ run configuration and point it to the same port as specified above
Debug this run configuration
“The suspend=y vm parameter will cause ant to start up only but not to run until a connection is made on the debug port (8000 in this case). Once you make the connection with your debug session, any breakpoint set in your task code will catch,” he says.