org.apache.tools.ant.taskdefs

Class WhichResource

public class WhichResource extends Task

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" >
 

Since: Ant 1.6

UNKNOWN: name="oneof" description="Exactly one of these two"

Method Summary
PathcreateClasspath()
Adds a path to the classpath.
voidexecute()
execute it
voidsetClass(String classname)
name the class to look for
voidsetClasspath(Path cp)
Set the classpath to be used for this compilation.
voidsetClasspathRef(Reference r)
Set the classpath to use by reference.
voidsetProperty(String property)
the property to fill with the URL of the resource or class
voidsetResource(String resource)
name the resource to look for

Method Detail

createClasspath

public Path createClasspath()
Adds a path to the classpath.

Returns: a classpath to be configured.

execute

public void execute()
execute it

Throws: BuildException on error

setClass

public void setClass(String classname)
name the class to look for

Parameters: classname the name of the class to look for.

UNKNOWN: group="oneof"

setClasspath

public void setClasspath(Path cp)
Set the classpath to be used for this compilation.

Parameters: cp the classpath to be used.

setClasspathRef

public void setClasspathRef(Reference r)
Set the classpath to use by reference.

Parameters: r a reference to an existing classpath.

Since: Ant 1.7.1

setProperty

public void setProperty(String property)
the property to fill with the URL of the resource or class

Parameters: property the property to be set.

UNKNOWN: group="required"

setResource

public void setResource(String resource)
name the resource to look for

Parameters: resource the name of the resource to look for.

UNKNOWN: group="oneof"