private ClassLoader createStartLoader()

in tools/maven-plugin/src/main/java/org/apache/batchee/tools/maven/StartMojo.java [92:125]


    private ClassLoader createStartLoader(final ClassLoader parent) throws MojoExecutionException {
        final Collection<URL> urls = new LinkedList<URL>();
        if (useProjectClasspath) {
            if (projectBinaries != null && projectBinaries.exists()) {
                try {
                    urls.add(projectBinaries.toURI().toURL());
                } catch (final MalformedURLException e) {
                    throw new MojoExecutionException(e.getMessage(), e);
                }
            }
            if (dependencies != null) {
                for (final Artifact dependency : dependencies) {
                    try {
                        urls.add(dependency.getFile().toURI().toURL());
                    } catch (final MalformedURLException e) {
                        throw new MojoExecutionException(e.getMessage(), e);
                    }
                }
            }
        }
        if (additionalClasspathEntries != null) {
            for (final String entry : additionalClasspathEntries) {
                try {
                    final File file = new File(entry);
                    if (file.exists()) {
                        urls.add(file.toURI().toURL());
                    }
                } catch (final MalformedURLException e) {
                    throw new MojoExecutionException(e.getMessage(), e);
                }
            }
        }
        return new URLClassLoader(urls.toArray(new URL[urls.size()]), parent);
    }