public RootLoader run() { return new RootLoader(lc); } });
/** * constructs a new RootLoader with a {@link LoaderConfiguration} * object which holds the classpath */ public RootLoader(LoaderConfiguration lc) { this(chooseParent()); Thread.currentThread().setContextClassLoader(this); URL[] urls = lc.getClassPathUrls(); for (URL url : urls) { addURL(url); } // TODO M12N eventually defer this until later when we have a full Groovy // environment and use normal Grape.grab() String groovyHome = System.getProperty("groovy.home"); List<String> grabUrls = lc.getGrabUrls(); for (String grabUrl : grabUrls) { Map<String, Object> grabParts = GrapeUtil.getIvyParts(grabUrl); String group = grabParts.get("group").toString(); String module = grabParts.get("module").toString(); String name = grabParts.get("module").toString() + "-" + grabParts.get("version") + ".jar"; File jar = new File(groovyHome + "/repo/" + group + "/" + module + "/jars/" + name); try { addURL(jar.toURI().toURL()); } catch (MalformedURLException e) { // ignore } } }
/** * loads a class using the name of the class */ protected synchronized Class loadClass(final String name, boolean resolve) throws ClassNotFoundException { Class c = this.findLoadedClass(name); if (c != null) return c; c = customClasses.get(name); if (c != null) return c; try { c = oldFindClass(name); } catch (ClassNotFoundException cnfe) { // IGNORE } if (c == null) c = super.loadClass(name, resolve); if (resolve) resolveClass(c); return c; }
/** * returns the URL of a resource, or null if it is not found */ public URL getResource(String name) { URL url = findResource(name); if (url == null) url = super.getResource(name); return url; }
/** * returns the URL of a resource, or null if it is not found */ public URL getResource(String name) { URL url = findResource(name); if (url == null) url = super.getResource(name); return url; }
/** * loads a class using the name of the class */ protected Class loadClass(final String name, boolean resolve) throws ClassNotFoundException { Class c = this.findLoadedClass(name); if (c != null) return c; c = (Class) customClasses.get(name); if (c != null) return c; try { c = oldFindClass(name); } catch (ClassNotFoundException cnfe) { // IGNORE } if (c == null) c = super.loadClass(name, resolve); if (resolve) resolveClass(c); return c; }
private RootLoader makeRoot() { String[] list = taskClasspath.list(); LoaderConfiguration lc = new LoaderConfiguration(); for (int i=0; i<list.length; i++) { if (list[i].matches(".*ant-[^/]*jar$")) { continue; } if (list[i].matches(".*commons-logging-[^/]*jar$")) { continue; } if (list[i].matches(".*xerces-[^/]*jar$")) { continue; } lc.addFile(list[i]); } return new RootLoader(lc); }
/** * constructs a new RootLoader with a @see LoaderConfiguration * object which holds the classpath */ public RootLoader(LoaderConfiguration lc) { this(chooseParent()); Thread.currentThread().setContextClassLoader(this); URL[] urls = lc.getClassPathUrls(); for (int i = 0; i < urls.length; i++) { addURL(urls[i]); } }
/** * returns the URL of a resource, or null if it is not found */ public URL getResource(String name) { URL url = findResource(name); if (url == null) url = super.getResource(name); return url; }
/** * loads a class using the name of the class */ protected Class loadClass(final String name, boolean resolve) throws ClassNotFoundException { Class c = this.findLoadedClass(name); if (c != null) return c; c = (Class) customClasses.get(name); if (c != null) return c; try { c = oldFindClass(name); } catch (ClassNotFoundException cnfe) { // IGNORE } if (c == null) c = super.loadClass(name, resolve); if (resolve) resolveClass(c); return c; }
return getIncludeantruntime() ? getClass().getClassLoader() : new AntClassLoader(new RootLoader(EMPTY_URL_ARRAY, null), getProject(), getClasspath());
/** * constructs a new RootLoader with a @see LoaderConfiguration * object which holds the classpath */ public RootLoader(LoaderConfiguration lc) { this(chooseParent()); Thread.currentThread().setContextClassLoader(this); URL[] urls = lc.getClassPathUrls(); for (int i = 0; i < urls.length; i++) { addURL(urls[i]); } }
/** * returns the URL of a resource, or null if it is not found */ public URL getResource(String name) { URL url = findResource(name); if (url == null) url = super.getResource(name); return url; }
/** * loads a class using the name of the class */ protected Class loadClass(final String name, boolean resolve) throws ClassNotFoundException { Class c = this.findLoadedClass(name); if (c != null) return c; c = (Class) customClasses.get(name); if (c != null) return c; try { c = oldFindClass(name); } catch (ClassNotFoundException cnfe) { // IGNORE } if (c == null) c = super.loadClass(name, resolve); if (resolve) resolveClass(c); return c; }
@Override public ClassLoader run() { return getIncludeantruntime() ? getClass().getClassLoader() : new AntClassLoader(new RootLoader(EMPTY_URL_ARRAY, null), getProject(), getClasspath()); } });
/** * constructs a new RootLoader with a {@link LoaderConfiguration} * object which holds the classpath */ public RootLoader(LoaderConfiguration lc) { this(chooseParent()); Thread.currentThread().setContextClassLoader(this); URL[] urls = lc.getClassPathUrls(); for (URL url : urls) { addURL(url); } }
/** * returns the URL of a resource, or null if it is not found */ public URL getResource(String name) { URL url = findResource(name); if (url == null) url = super.getResource(name); return url; }
/** * loads a class using the name of the class */ protected synchronized Class loadClass(final String name, boolean resolve) throws ClassNotFoundException { Class c = this.findLoadedClass(name); if (c != null) return c; c = (Class) customClasses.get(name); if (c != null) return c; try { c = oldFindClass(name); } catch (ClassNotFoundException cnfe) { // IGNORE } if (c == null) c = super.loadClass(name, resolve); if (resolve) resolveClass(c); return c; }
private RootLoader makeRoot() { String[] list = taskClasspath.list(); LoaderConfiguration lc = new LoaderConfiguration(); for (int i=0; i<list.length; i++) { if (list[i].matches(".*ant-[^/]*jar$")) { continue; } if (list[i].matches(".*commons-logging-[^/]*jar$")) { continue; } if (list[i].matches(".*xerces-[^/]*jar$")) { continue; } lc.addFile(list[i]); } return new RootLoader(lc); }
/** * constructs a new RootLoader with a @see LoaderConfiguration * object which holds the classpath */ public RootLoader(LoaderConfiguration lc) { this(chooseParent()); Thread.currentThread().setContextClassLoader(this); URL[] urls = lc.getClassPathUrls(); for (int i = 0; i < urls.length; i++) { addURL(urls[i]); } }