private static Archive defaultArchive() { try { final ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); UrlSet urls = new UrlSet(classLoader); urls = urls.excludeJvm(); urls = urls.exclude(classLoader.getParent()); return new ClasspathArchive(classLoader, urls.getUrls()); } catch (final IOException e) { throw new IllegalStateException(e); } }
private static Archive defaultArchive() { try { final ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); UrlSet urls = new UrlSet(classLoader); urls = urls.excludeJvm(); urls = urls.exclude(classLoader.getParent()); return new ClasspathArchive(classLoader, urls.getUrls()); } catch (final IOException e) { throw new IllegalStateException(e); } }
private static Archive cpArchive() { try { final ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); return new ClasspathArchive( classLoader, new UrlSet(classLoader).excludeJvm().exclude(classLoader.getParent()).getUrls()); } catch (final IOException e) { throw new IllegalStateException(e); } }
public static UrlSet cullSystemJars(final UrlSet original) throws IOException { UrlSet urls = new UrlSet(original.getUrls()); urls = urls.exclude(ClassLoader.getSystemClassLoader().getParent()); urls = urls.excludeJvm(); urls = urls.excludePaths(System.getProperty("sun.boot.class.path", "")); urls = urls.exclude(".*/JavaVM.framework/.*"); return urls; }
final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); files = new UrlSet(ClassLoaders.findUrls(contextClassLoader)) .excludeJvm() .getUrls() .stream()
private static Set<URL> findUrls(final ClassLoader classLoader, final Properties args) throws IOException { if ("true".equals(args.getProperty("fast-scan", "true"))) { try { return new HashSet<>(NewLoaderLogic.applyBuiltinExcludes(new UrlSet(ClassLoaders.findUrls(classLoader)).excludeJvm()).getUrls()); } catch (final Throwable fallback) { // let it fallback } } return ClassLoaders.findUrls(classLoader); }
public static UrlSet cullSystemJars(final UrlSet original) throws IOException { final String sunboot = JavaSecurityManagers.getSystemProperty("sun.boot.class.path", ""); UrlSet urls = new UrlSet(original.getUrls()); urls = urls.exclude(ClassLoader.getSystemClassLoader().getParent()); urls = urls.excludeJvm(); if (!sunboot.isEmpty()) { // else on java9 it excludes new File(".") so all maven builds fail urls = urls.excludePaths(sunboot); } urls = urls.exclude(".*/JavaVM.framework/.*"); return urls; }
private void installExtensions() { try { final Collection<URL> urls = NewLoaderLogic.applyBuiltinExcludes(new UrlSet(Assembler.class.getClassLoader()).excludeJvm()).getUrls(); Extensions.installExtensions(new Extensions.Finder("META-INF", false, urls.toArray(new URL[urls.size()]))); return; } catch (final IOException e) { // no-op } // if an error occurred do it brutely Extensions.installExtensions(new Extensions.Finder("META-INF", true)); }
private void installExtensions() { try { final Collection<URL> urls = NewLoaderLogic.applyBuiltinExcludes(new UrlSet(Assembler.class.getClassLoader()).excludeJvm()).getUrls(); Extensions.installExtensions(new Extensions.Finder("META-INF", false, urls.toArray(new URL[urls.size()]))); return; } catch (final IOException e) { // no-op } // if an error occurred do it brutely Extensions.installExtensions(new Extensions.Finder("META-INF", true)); }