}
// Check validity of members
checkValidity();
DefaultContext rootCtx = new DefaultContext();
DefaultConfiguration configuration = new DefaultConfiguration("root", "");
Cocoon cocoon = null;
CocoonFactory cocoonFactory = null;
try {
// fill rootCtx
rootCtx.put("dest-dir", destDir);
rootCtx.put("context-root", this.contextDir);
rootCtx.put(Constants.CONTEXT_WORK_DIR, this.workDir);
rootCtx.put(Constants.CONTEXT_CONFIG_URL, configFile.toURL());
ClassLoader classLoader = null;
if (this.cocoonClasspath != null) {
//
// I think there is no real need for creating an additional
// AntClassLoader
// CocoonTask was already loaded via an AntClassLoader by Ant
//
AntClassLoader antClassLoader = new AntClassLoader(this.project, this.cocoonClasspath, false);
log("Using Class Loader having classpath " + String.valueOf(this.cocoonClasspath), Project.MSG_INFO);
classLoader = antClassLoader;
} else {
classLoader = this.getClass().getClassLoader();
}
rootCtx.put(Constants.CONTEXT_CLASS_LOADER, classLoader);
// set classloader explicitly
// this is very important otherwise ClassUtils.loadClass(), et al.
// will use the system classloader for loading classes, and resources
// but only this class (the CocoonTask) was loaded via an