How do I turn a <path> into an Ant property value?

Jeff Turner

For example:

  <path id="tools.class.path">
    <pathelement location="${xerces.jar}"/>
    <pathelement location="${testlet.jar}"/>
    <pathelement location="${junit.jar}"/>
    <pathelement location="${tools.jar}"/>
    <fileset dir="${tools.dir}/lib">
      <include name="*.jar" />
      <exclude name="testlet.jar"/>
      <exclude name="xerces.jar"/>
It would be nice to be able to print the contents of this path, for debugging. The obvious approach:
  <echo message="Classpath is ${tools.class.path}"/>
Doesn't work.

Here's how: First declare a property, referring to the path. Then print the property:

  <property name="cp" refid="tools.class.path"/>
  <echo message="Classpath is ${cp}"/>