Search in sources :

Example 1 with FilterGradleClassLoader

use of org.apache.tomee.gradle.embedded.classloader.FilterGradleClassLoader in project tomee by apache.

the class TomEEEmbeddedTask method createLoader.

private ClassLoader createLoader(final ClassLoader parent) {
    getLogger().info("Resolving tomee-embedded classpath...");
    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.tomee.gradle.embedded.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.tomee.gradle.embedded.classloader.FilterGradleClassLoader)1 Configuration (org.gradle.api.artifacts.Configuration)1