Is it possible to have Ant print out the classpath for a particular target? If so, how?

Solution 1:

Use the pathconvert task to convert a path to a property

<path id="classpath">
....
</path>

<pathconvert property="classpathProp" refid="classpath"/>

<echo>Classpath is ${classpathProp}</echo>

Docs for pathconvert.

Solution 2:

This is even easier with versions of Ant > 1.6

<echo>${toString:classpath}</echo>

See http://ant.apache.org/manual/using.html#pathshortcut for more information