1 package org.apache.maven; 2 3 18 19 import org.codehaus.classworlds.ClassRealm; 20 import org.codehaus.classworlds.ClassWorld; 21 import org.codehaus.plexus.DefaultPlexusContainer; 22 import org.codehaus.plexus.PlexusContainer; 23 24 import java.io.File ; 25 26 32 public class MavenTestUtils 33 { 34 private MavenTestUtils() 35 { 36 } 37 38 public static PlexusContainer getContainerInstance() 39 { 40 return new DefaultPlexusContainer(); 41 } 42 43 public static void customizeContext( PlexusContainer container, File basedir, File mavenHome, File mavenHomeLocal ) 44 throws Exception 45 { 46 ClassWorld classWorld = new ClassWorld(); 47 48 ClassRealm rootClassRealm = classWorld.newRealm( "root", Thread.currentThread().getContextClassLoader() ); 49 50 container.addContextValue( "rootClassRealm", rootClassRealm ); 51 52 container.addContextValue( "maven.home", mavenHome.getAbsolutePath() ); 53 54 container.addContextValue( "maven.home.local", mavenHomeLocal.getAbsolutePath() ); 55 } 56 } 57 | Popular Tags |