private ClassLoader createClassLoader(final List<String> classpathElements) {
    getLog().debug("Classpath elements:");
    final List<URL> urls = new ArrayList<URL>();
    try {
      for (final String element : classpathElements) {
        final File elementFile = new File(element);
        getLog().debug("Adding element to plugin classpath: " + elementFile.getPath());
        urls.add(elementFile.toURI().toURL());
      }
    } catch (final Exception e) {
      getLog().error("Error retreiving URL for artifact", e);
      throw new RuntimeException(e);
    }
    return new URLClassLoader(urls.toArray(new URL[] {}), Thread.currentThread().getContextClassLoader());
  }
private ClassLoader createClassLoader ( final List < String > classpathElements ) { getLog ( ) . debug ( "Classpath elements:" ) ; final List < URL > urls = new ArrayList < URL > ( ) ; try { for ( final String element : classpathElements ) { final File elementFile = new File ( element ) ; getLog ( ) . debug ( "Adding element to plugin classpath: " + elementFile . getPath ( ) ) ; urls . add ( elementFile . toURI ( ) . toURL ( ) ) ; } } catch ( final Exception e ) { getLog ( ) . error ( "Error retreiving URL for artifact" , e ) ; throw new RuntimeException ( e ) ; } return new URLClassLoader ( urls . toArray ( new URL [ ] { } ) , Thread . currentThread ( ) . getContextClassLoader ( ) ) ; }
@return {@link ClassRealm} based on project dependencies.