/** * Create an Ant Class Loader */ public AntClassLoader() { setParent(null); }
/** * Creates a classloader for the given project using the classpath given. * * @param parent The parent classloader to which unsatisfied loading * attempts are delegated. May be <code>null</code>, * in which case the classloader which loaded this * class is used as the parent. * @param project The project to which this classloader is to belong. * Must not be <code>null</code>. * @param classpath the classpath to use to load the classes. * May be <code>null</code>, in which case no path * elements are set up to start with. * @param parentFirst If <code>true</code>, indicates that the parent * classloader should be consulted before trying to * load the a class through this loader. */ public AntClassLoader(final ClassLoader parent, final Project project, final Path classpath, final boolean parentFirst) { this(project, classpath); if (parent != null) { setParent(parent); } setParentFirst(parentFirst); addJavaLibraries(); }
} else { loader = project.createClassLoader(classpath); loader.setParent(project.getCoreLoader()); loader.setParentFirst(false); loader.addJavaLibraries();
/** * Creates an empty class loader. The classloader should be configured * with path elements to specify where the loader is to look for * classes. * * @param parent The parent classloader to which unsatisfied loading * attempts are delegated. May be <code>null</code>, * in which case the classloader which loaded this * class is used as the parent. * @param parentFirst If <code>true</code>, indicates that the parent * classloader should be consulted before trying to * load the a class through this loader. */ public AntClassLoader(final ClassLoader parent, final boolean parentFirst) { setParent(parent); project = null; this.parentFirst = parentFirst; }
if (getClass().getClassLoader() != null && getClass().getClassLoader() != Project.class.getClassLoader()) { classLoader.setParent(getClass().getClassLoader());
/** * Create an Ant ClassLoader for a given project, with * a parent classloader and an initial classpath. * @since Ant 1.7. * @param parent the parent for this classloader. * @param project The project to which this classloader is to * belong. * @param classpath The classpath to use to load classes. */ public AntClassLoader(final ClassLoader parent, final Project project, final Path classpath) { setParent(parent); setClassPath(classpath); setProject(project); }
/** * Creates a classloader for the given project using the classpath given. * * @param project The project to which this classloader is to belong. * Must not be <code>null</code>. * @param classpath The classpath to use to load the classes. This * is combined with the system classpath in a manner * determined by the value of ${build.sysclasspath}. * May be <code>null</code>, in which case no path * elements are set up to start with. */ public AntClassLoader(final Project project, final Path classpath) { setParent(null); setProject(project); setClassPath(classpath); }
/** Configures the classpath which we'll use to load service classes. */ public void setClasspathref (Reference pathref) { _cloader = ClasspathUtils.getClassLoaderForPath(getProject(), pathref); // set the parent of the classloader to be the classloader used to load this task, rather // than the classloader used to load Ant, so that we have access to Narya classes like // TransportHint ((AntClassLoader)_cloader).setParent(getClass().getClassLoader()); }
/** Configures the classpath which we'll use to load service classes. */ public void setClasspath (Path path) { _cloader = ClasspathUtils.getClassLoaderForPath(getProject(), path, "narya"); // set the parent of the classloader to be the classloader used to load this task, rather // than the classloader used to load Ant, so that we have access to Narya classes like // TransportHint ((AntClassLoader)_cloader).setParent(getClass().getClassLoader()); }
try { ClassLoader classLoader = this.getClass().getClassLoader(); loader.setParent(classLoader ); // if this is not set, classes from the taskdef cannot be found - which is crucial for e.g. annotations. loader.setThreadContextLoader();
try { ClassLoader classLoader = this.getClass().getClassLoader(); loader.setParent(classLoader ); // if this is not set, classes from the taskdef cannot be found - which is crucial for e.g. annotations. loader.setThreadContextLoader();