Parsing your .classpath file in Ant

“Don’t you worry how your project gets built, lets us worry about it!”
                                                           -Probably some IBM RAD Engineer

To build and deploy your enterprise applications from RAD (or WSAD, or RSA) you have to run a headless version of your IDE and call special IBM ant tasks that basically say, “Build and Deploy” and your CTO’s favorite IDE then just does it based on your project files. This is fun and all but we now want to instrument all our code with Cobertura as part of our continuous integration project.

One way I figured out how to get access to your project settings is to parse the .classpath file. This is an issue with us because we have 10+ enterprise projects so we can’t just hardcode the path to the SRC folder. Here is how I parse the .classpath file from Ant.

1) Become farmiliar with IBM’s proprietary ANT tasks, and quickly realize they are poorly documented, and will not help:

2) Install the XML Ant task:

3) Quickly learn how XPath’s work:

4) Write a target to parse out the SRC dir:



One thought on “Parsing your .classpath file in Ant

Comments are closed.