If you want to debug the source code of Ant or of custom Ant tasks that you 
develop and you are using Eclipse or RAD. here is what you can do.

Ant can be started as an "External Tool". In the External Tools Conifgurations 
dialog box, you can create an "Ant Build" build configuration, selecting the 
build file that you want to run and the target. 

In order to be able to debug the source code of Ant or of your custom tasks, 
you want to open the JRE tab and enter VM arguments, for instance these :  
-Xdebug -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000

The suspend=y option in the VM arguments means that the Ant VM will wait on you 
starting debugging to run.

You then create in the menu Run/Debug a debug configuration using the same port 
8000. See for instance this link [1]  or [2] concerning remote debugging. You 
will want to create an Eclipse project "Ant" inside Eclipse and put this 
project on the class path of your debug configuration so that you can put 
breakpoints inside the code of Ant and actually hit these breakpoints.

Once you have setup both your external tool configuration and the remote java 
debug configuration, you need to first kick off the external tool 
configuration. Because of "suspend=y" it is going to hang for a short time 
until you activate the "remote" debugging configuration. Once the remote 
debugging configuration is started and you see the message saying something 
like VM connected on port 8000 you will be able to debug the code of Ant.

Eclipse can also debug Ant build files since Eclipse 3.1 according to this 
document [3].  Which links also to this one [4] titled "Make Ant easy with 
Eclipse"


Regards,

Antoine

[1] 
http://www.ibm.com/developerworks/java/library/os-eclipse-javadebug/index.html
[2] 
http://javarevisited.blogspot.com/2011/02/how-to-setup-remote-debugging-in.html
[3] http://www.eclipsezone.com/eclipse/forums/t71656.html
[4] http://www.ibm.com/developerworks/opensource/tutorials/os-ecl-easyant/


On Jan 20, 2013, at 6:29 PM, WebServices Development wrote:

> Is there a way to debug ANT source by using it to build inside Rational 
> Application Developer ( RAD ) or Eclipse?
> 
> I have downloaded the ANT 1.8.4 source and did a build in RAD using the 
> build.xml which created the ant jar files.  I then tried to create a launcher 
> using these built jar files, but I am unable to put a breakpoint in them.  
> Ami missing something or am I going about it the wrong way?
> 
> Is there a way to run an ANT build in RAD using these ANT jar files and set a 
> break-point?
> 
> Thank you.
> 
> 

Reply via email to