Hi,
I extracted the code from AntHill (the gui tool I'm working on). See email
attachment.
I use a modified org.apache.tools.ant.Project class to setup the extra tasks
loading:
Project project = new Project() {
boolean extraLoaded = false;
public Task createTask(String taskType) throws BuildException {
if (!extraLoaded) {
try {
// here comes the extra task loading
ExtraTask.load(this);
} catch (Exception e) { throw new BuildException("Failed to load
addins", e); }
extraLoaded = true;
}
return super.createTask(taskType);
}
};
Don't know yet where it can be included in Ant code, I'm sure Ant gurus will
find out.
But ExtraTask.load(Project) needs to be called only when basedir has been
set by ant.
ExtraTask uses AntClassLoader and Path and they rely on the basedir
attribute.
Hope this helps,
Frederic Lavigne, fred@L2FProd.com
java software at http://www.L2FProd.com
|