/** * Gets a fresh, different, previously unused classloader that uses the * passed path as its classpath. * * <p>This method completely ignores the ant.reuse.loader magic * property and should be used with caution.</p> * @param p Ant Project where the handled components are living in. * @param path the classpath for this loader * @param reverseLoader if set to true this new loader will take * precedence over its parent (which is contra the regular * classloader behaviour) * @return The fresh, different, previously unused class loader. */ public static ClassLoader getUniqueClassLoaderForPath(Project p, Path path, boolean reverseLoader) { AntClassLoader acl = p.createClassLoader(path); if (reverseLoader) { acl.setParentFirst(false); acl.addJavaLibraries(); } return acl; }
if (ignoreSystemClasses) { loader = getProject().createClassLoader(classpath); loader.setParentFirst(false); loader.addJavaLibraries(); try {
/** * 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(); }
if (ignoreSystemclasses) { loader = getProject().createClassLoader(classpath); loader.setParentFirst(false); loader.addJavaLibraries(); try {
loader = project.createClassLoader(classpath); loader.setParent(project.getCoreLoader()); loader.setParentFirst(false); loader.addJavaLibraries(); loader.setIsolated(true);
classLoader.setParent(getClass().getClassLoader()); classLoader.setParentFirst(false); classLoader.addJavaLibraries(); log("Using CLASSPATH " + classLoader.getClasspath(),