o Refactored code

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@901751 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2010-01-21 15:54:28 +00:00
parent 04983c0111
commit a789d4c288
3 changed files with 15 additions and 3 deletions

View File

@ -35,6 +35,13 @@ import org.codehaus.plexus.classworlds.realm.ClassRealm;
public interface ClassRealmManager public interface ClassRealmManager
{ {
/**
* Gets the class realm hosting the Maven core.
*
* @return The class realm hosting the Maven core, never {@code null}.
*/
ClassRealm getCoreRealm();
/** /**
* Creates a new class realm for the specified project and its build extensions. * Creates a new class realm for the specified project and its build extensions.
* *

View File

@ -104,7 +104,7 @@ public class DefaultClassRealmManager
} }
else else
{ {
classRealm.setParentRealm( container.getContainerRealm() ); classRealm.setParentRealm( getCoreRealm() );
importMavenApi( classRealm ); importMavenApi( classRealm );
} }
@ -141,7 +141,7 @@ public class DefaultClassRealmManager
*/ */
private void importXpp3Dom( ClassRealm importingRealm ) private void importXpp3Dom( ClassRealm importingRealm )
{ {
ClassRealm coreRealm = container.getContainerRealm(); ClassRealm coreRealm = getCoreRealm();
importingRealm.importFrom( coreRealm, "org.codehaus.plexus.util.xml.Xpp3Dom" ); importingRealm.importFrom( coreRealm, "org.codehaus.plexus.util.xml.Xpp3Dom" );
importingRealm.importFrom( coreRealm, "org.codehaus.plexus.util.xml.pull.XmlPullParser" ); importingRealm.importFrom( coreRealm, "org.codehaus.plexus.util.xml.pull.XmlPullParser" );
@ -185,6 +185,11 @@ public class DefaultClassRealmManager
importingRealm.importFromParent( "org.codehaus.plexus.PlexusContainerException" ); importingRealm.importFromParent( "org.codehaus.plexus.PlexusContainerException" );
} }
public ClassRealm getCoreRealm()
{
return container.getContainerRealm();
}
public ClassRealm createProjectRealm( Model model ) public ClassRealm createProjectRealm( Model model )
{ {
if ( model == null ) if ( model == null )

View File

@ -439,7 +439,7 @@ public class DefaultProjectBuildingHelper
if ( projectRealm == null ) if ( projectRealm == null )
{ {
projectRealm = container.getContainerRealm(); projectRealm = classRealmManager.getCoreRealm();
} }
Thread.currentThread().setContextClassLoader( projectRealm ); Thread.currentThread().setContextClassLoader( projectRealm );