@SuppressWarnings("unchecked")
    protected final ClassLoader getClassLoader()
        throws MojoExecutionException, DependencyResolutionRequiredException {

        final MavenProject project = project();

        final List<String> classpathElements = new ArrayList<>();
        classpathElements.addAll(project.getCompileClasspathElements());
        classpathElements.addAll(project.getRuntimeClasspathElements());
        classpathElements.add(project.getBuild().getOutputDirectory());

        final List<URL> projectClasspathList = new ArrayList<>();

        for (final String element : classpathElements) {
            try {
                projectClasspathList.add(new File(element).toURI().toURL());
            } catch (final MalformedURLException ex) {
                throw new MojoExecutionException(
                    element + " is an invalid classpath element", ex
                );
            }
        }

        return new URLClassLoader(
            projectClasspathList.toArray(new URL[projectClasspathList.size()]),
            Thread.currentThread().getContextClassLoader()
        );
    }
Returns if the specified file is non-null, exists and is readable. If,
not, {@code false} is returned and an appropriate message is shown in the
console.

@param file the config file to check
@return {@code true} if available, else {@code false}
build-parent/maven-plugin/src/main/java/com/speedment/maven/abstractmojo/AbstractSpeedmentMojo.java