private PlexusContainer createContainer()
throws PlexusContainerException
{
DefaultPlexusContainer child = new DefaultPlexusContainer();
ClassWorld classWorld = container.getClassWorld();
child.setClassWorld( classWorld );
ClassRealm childRealm = null;
// note: ideally extensions would live in their own realm, but this would mean that things like wagon-scm would
// have no way to obtain SCM extensions
String childRealmId = "plexus.core.child-container[" + CONTAINER_NAME + "]";
try
{
childRealm = classWorld.getRealm( childRealmId );
}
catch ( NoSuchRealmException e )
{
try
{
childRealm = classWorld.newRealm( childRealmId );
}
catch ( DuplicateRealmException impossibleError )
{
getLogger().error( "An impossible error has occurred. After getRealm() failed, newRealm() " +
"produced duplication error on same id!", impossibleError );