protected ClassLoader getClassLoaderIncludingProjectClasspath() throws MojoExecutionException {
        try {
            List classpathElements = project.getCompileClasspathElements();
            classpathElements.add(project.getBuild().getOutputDirectory());
            URL urls[] = new URL[classpathElements.size()];
            for (int i = 0; i < classpathElements.size(); ++i) {
                urls[i] = new File((String) classpathElements.get(i)).toURI().toURL();
            }
            return new URLClassLoader(urls, getMavenArtifactClassLoader());
        } catch (Exception e) {
            throw new MojoExecutionException("Failed to create project classloader", e);
        }
    }
protected ClassLoader getClassLoaderIncludingProjectClasspath() throws MojoExecutionException {
        try {
            List classpathElements = project.getCompileClasspathElements();
            classpathElements.add(project.getBuild().getOutputDirectory());
            URL urls[] = new URL[classpathElements.size()];
            for (int i = 0; i < classpathElements.size(); ++i) {
                urls[i] = new File((String) classpathElements.get(i)).toURI().toURL();
            }
            return new URLClassLoader(urls, getMavenArtifactClassLoader());
        } catch (Exception e) {
            throw new MojoExecutionException("Failed to create project classloader", e);
        }
    }
protected ClassLoader getClassLoaderIncludingProjectClasspath ( ) throws MojoExecutionException { try { List classpathElements = project . getCompileClasspathElements ( ) ; classpathElements . add ( project . getBuild ( ) . getOutputDirectory ( ) ) ; URL urls [ ] = new URL [ classpathElements . size ( ) ] ; for ( int i = 0 ; i < classpathElements . size ( ) ; ++ i ) { urls [ i ] = new File ( ( String ) classpathElements . get ( i ) ) . toURI ( ) . toURL ( ) ; } return new URLClassLoader ( urls , getMavenArtifactClassLoader ( ) ) ; } catch ( Exception e ) { throw new MojoExecutionException ( "Failed to create project classloader" , e ) ; } }
Returns an isolated classloader.

@return ClassLoader
@noinspection unchecked
Returns an isolated classloader .