Given a fileset of *.jar is passed to a custom task, how can MyTask load
the classes it requires? I have a classpath attribute that is a fileset.
I've passed this to my task. As this is a collection of jar files, what now
must be done to load the class? Code snippet appreciated.
e.g.
public class MyTask
{
Path classpath = null;
/**
* Set the classpath to be used for this compilation.
*/
public void setClasspath(Path aClasspath) {
if (this.classpath == null) {
this.classpath = aClasspath;
} else {
this.classpath.append(aClasspath);
}
}
/**
* Set the classpath to be used for this compilation.
*/
public void addClasspath(Path aClasspath) {
if (this.classpath == null) {
this.classpath = aClasspath;
} else {
this.classpath.append(aClasspath);
}
}
/**
* Creates a nested classpath element.
*/
public Path createClasspath() {
if (classpath == null) {
classpath = new Path(project);
}
return classpath.createPath();
}
/**
* Adds a reference to a CLASSPATH defined elsewhere.
*/
public void setClasspathRef(Reference r) {
createClasspath().setRefid(r);
}
public void execute() throws BuildException() {
.
.
.
// need to load class javancss.Javancss as it is not in our system
classpath.
javancss.Javancss ncss = new javancss.Javancss( cmdArgs,
Main.S_RCS_HEADER);
}
}
T Master.