Top Description Fields Constructors Methods
org.apache.tools.ant.taskdefs

public Class Classloader

extends Task
Class Inheritance
Imports
java.io.File, org.apache.tools.ant.AntClassLoader, .BuildException, .MagicNames, .Project, .Task, org.apache.tools.ant.types.Path, .Reference, org.apache.tools.ant.util.StringUtils

EXPERIMENTAL Create or modifies ClassLoader. The required pathRef parameter will be used to add classpath elements. The classpath is a regular path. Currently only file components are supported (future extensions may allow URLs). You can modify the core loader by not specifying any name or using "ant.coreLoader". (the core loader is used to load system ant tasks and for taskdefs that don't specify an explicit path). Taskdef and typedef can use the loader you create if the name follows the "ant.loader.NAME" pattern. NAME will be used as a pathref when calling taskdef. This tasks will not modify the core loader if "build.sysclasspath=only" The typical use is:
 <path id="ant.deps" >
    <fileset dir="myDir" >
       <include name="junit.jar, bsf.jar, js.jar, etc"/>
    </fileset>
 </path>

 <classloader pathRef="ant.deps" />

Field Summary

Modifier and TypeField and Description
private Path
private String
private boolean
private String
private boolean
public static final String
Inherited from org.apache.tools.ant.Task:
targettaskNametaskTypewrapper

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Path

Returns:

a path for configuration.
createClasspath
()

Create a classpath.

public void
execute()

Overrides org.apache.tools.ant.Task.execute.

do the classloader manipulation.
public void
setClasspath(Path
an Ant Path object containing the classpath.
classpath
)

Set the classpath to be used when searching for component being defined

public void
setClasspathRef(Reference
a reference to a path.
pathRef
)

Specify which path will be used.

public void
setName(String
the name of this loader
name
)

Name of the loader.

public void
setParentFirst(boolean
if true reverse the normal classloader lookup.
b
)

Set reverse attribute.

public void
setParentName(String
the parent name.
name
)

Set the name of the parent.

public void
setReset(boolean
true if the loader is to be reset.
b
)

Reset the classloader, if it already exists.

public void
setReverse(boolean
if true reverse the normal classloader lookup.
b
)

Deprecated use setParentFirst with a negated argument instead
Set reverse attribute.
Inherited from org.apache.tools.ant.Task:
bindToOwnergetOwningTargetgetRuntimeConfigurableWrappergetTaskNamegetTaskTypegetWrapperhandleErrorFlushhandleErrorOutputhandleFlushhandleInputhandleOutputinitisInvalidloglogloglogmaybeConfigureperformreconfiguresetOwningTargetsetRuntimeConfigurableWrappersetTaskNamesetTaskType

Field Detail

classpathback to summary
private Path classpath
nameback to summary
private String name
parentFirstback to summary
private boolean parentFirst
parentNameback to summary
private String parentName
resetback to summary
private boolean reset
SYSTEM_LOADER_REFback to summary
public static final String SYSTEM_LOADER_REF
See Also
MagicNames#SYSTEM_LOADER_REF

Constructor Detail

Classloaderback to summary
public Classloader()

Method Detail

createClasspathback to summary
public Path createClasspath()

Create a classpath.

Returns:Path

a path for configuration.

executeback to summary
public void execute()

Overrides org.apache.tools.ant.Task.execute.

do the classloader manipulation.

Annotations
@Override
setClasspathback to summary
public void setClasspath(Path classpath)

Set the classpath to be used when searching for component being defined

Parameters
classpath:Path

an Ant Path object containing the classpath.

setClasspathRefback to summary
public void setClasspathRef(Reference pathRef) throws BuildException

Specify which path will be used. If the loader already exists and is an AntClassLoader (or any other loader we can extend), the path will be added to the loader.

Parameters
pathRef:Reference

a reference to a path.

Exceptions
BuildException:
if there is a problem.
setNameback to summary
public void setName(String name)

Name of the loader. If none, the default loader will be modified

Parameters
name:String

the name of this loader

setParentFirstback to summary
public void setParentFirst(boolean b)

Set reverse attribute.

Parameters
b:boolean

if true reverse the normal classloader lookup.

setParentNameback to summary
public void setParentName(String name)

Set the name of the parent.

Parameters
name:String

the parent name.

setResetback to summary
public void setReset(boolean b)

Reset the classloader, if it already exists. A new loader will be created and all the references to the old one will be removed. (it is not possible to remove paths from a loader). The new path will be used.

Parameters
b:boolean

true if the loader is to be reset.

setReverseback to summary
public void setReverse(boolean b)

Deprecated

use setParentFirst with a negated argument instead

Set reverse attribute.

Parameters
b:boolean

if true reverse the normal classloader lookup.

Annotations
@Deprecated