Search in sources :

Example 1 with FilterGradleClassLoader

use of org.apache.meecrowave.gradle.classloader.FilterGradleClassLoader in project meecrowave by apache.

the class MeecrowaveTask method createLoader.

private ClassLoader createLoader(final ClassLoader parent) {
    final Collection<URL> urls = new LinkedHashSet<>(64);
    addFiles(modules, urls);
    for (final Configuration cc : getProject().getConfigurations()) {
        if (applicationScopes.contains(cc.getName())) {
            addFiles(cc.getFiles(), urls);
        }
    }
    addFiles(classpath.getFiles(), urls);
    // use JVM loader to avoid the noise of gradle and its plugins
    return new URLClassLoader(urls.toArray(new URL[urls.size()]), new FilterGradleClassLoader(parent, classloaderFilteredPackages));
}
Also used : LinkedHashSet(java.util.LinkedHashSet) FilterGradleClassLoader(org.apache.meecrowave.gradle.classloader.FilterGradleClassLoader) Configuration(org.gradle.api.artifacts.Configuration) URLClassLoader(java.net.URLClassLoader) URL(java.net.URL)

Aggregations

URL (java.net.URL)1 URLClassLoader (java.net.URLClassLoader)1 LinkedHashSet (java.util.LinkedHashSet)1 FilterGradleClassLoader (org.apache.meecrowave.gradle.classloader.FilterGradleClassLoader)1 Configuration (org.gradle.api.artifacts.Configuration)1