Whichresource
Description
Find a class or resource on the supplied classpath, or the system classpath if none is supplied. The named property is set if the item can be found. For example:
<whichresource resource="/log4j.properties" property="log4j.url" >Parameters
Attribute Description Required property The property to fill with the URL of the resource of class. Yes class The name of the class to look for. Exactly one of these. resource The name of the resource to look for. classpath The classpath to use when looking up class
orresource
.No classpathref The classpath to use, given as a reference to a path defined elsewhere. Since Apache Ant 1.7.1. No Parameters specified as nested elements
classpath
Whichresource
'sclasspath
attribute is a path-like structure and can also be set via a nested<classpath>
element.Examples
The following shows using a classpath reference.
<path id="bsf.classpath"> <fileset dir="${user.home}/lang/bsf" includes="*.jar"/> </path> <whichresource property="bsf.class.location" class="org.apache.bsf.BSFManager" classpathref="bsf.classpath"/> <echo>${bsf.class.location}</echo>The following shows using a nested classpath.
<whichresource property="ant-contrib.antlib.location" resource="net/sf/antcontrib/antlib.xml"> <classpath> <path path="f:/testing/ant-contrib/target/ant-contrib.jar"/> </classpath> </whichresource> <echo>${ant-contrib.antlib.location}</echo>