private ClassLoader getClassLoader ( ) throws MojoExecutionException { List < Path > classpathURLs = new ArrayList <> ( ) ; this . addRelevantPluginDependenciesToClasspath ( classpathURLs ) ; this . addRelevantProjectDependenciesToClasspath ( classpathURLs ) ; this . addAdditionalClasspathElements ( classpathURLs ) ; try { return LoaderFinder . find ( classpathURLs , mainClass ) ; } catch ( NullPointerException | IOException e ) { throw new MojoExecutionException ( e . getMessage ( ) , e ) ; } }
Set up a classloader for the execution of the main class .