}
private ClassRealm setupContainerRealm( CliRequest cliRequest )
throws Exception
{
ClassRealm containerRealm = null;
String extClassPath = cliRequest.userProperties.getProperty( EXT_CLASS_PATH );
if ( extClassPath == null )
{
extClassPath = cliRequest.systemProperties.getProperty( EXT_CLASS_PATH );
}
if ( StringUtils.isNotEmpty( extClassPath ) )
{
String[] jars = StringUtils.split( extClassPath, File.pathSeparator );
if ( jars.length > 0 )
{
ClassRealm coreRealm = cliRequest.classWorld.getClassRealm( "plexus.core" );
if ( coreRealm == null )
{
coreRealm = (ClassRealm) cliRequest.classWorld.getRealms().iterator().next();
}
ClassRealm extRealm = cliRequest.classWorld.newRealm( "maven.ext", null );
slf4jLogger.debug( "Populating class realm " + extRealm.getId() );
for ( String jar : jars )
{
File file = resolveFile( new File( jar ), cliRequest.workingDirectory );
slf4jLogger.debug( " Included " + file );
extRealm.addURL( file.toURI().toURL() );
}
extRealm.setParentRealm( coreRealm );
containerRealm = extRealm;
}
}