o the session has no lookup or access to the container now

git-svn-id: https://svn.apache.org/repos/asf/maven/components/branches/MNG-2766@760333 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2009-03-31 04:59:06 +00:00
parent d9ac548e59
commit 46c8c09a91
9 changed files with 17 additions and 23 deletions

View File

@ -41,11 +41,13 @@
<groupId>org.apache.maven</groupId>
<artifactId>maven-project-builder</artifactId>
</dependency>
<!--
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-toolchain</artifactId>
<scope>runtime</scope>
<scope>test</scope>
</dependency>
-->
<!-- Plexus -->
<dependency>
<groupId>org.codehaus.plexus</groupId>

View File

@ -36,7 +36,7 @@ public class DefaultArtifactFilterManager
implements ArtifactFilterManager
{
private static final Set DEFAULT_EXCLUSIONS;
private static final Set<String> DEFAULT_EXCLUSIONS;
static
{
@ -78,7 +78,7 @@ public class DefaultArtifactFilterManager
DEFAULT_EXCLUSIONS = artifacts;
}
protected Set excludedArtifacts = new HashSet( DEFAULT_EXCLUSIONS );
protected Set<String> excludedArtifacts = new HashSet<String>( DEFAULT_EXCLUSIONS );
/**
* @deprecated Use this class as a component instead, and then use getArtifactFilter().

View File

@ -144,7 +144,7 @@ public class DefaultMaven
try
{
session = new MavenSession( container, request, projects );
session = new MavenSession( request, projects );
result.setReactorManager( session.getReactorManager() );
}

View File

@ -676,6 +676,7 @@ public class DefaultMavenExecutionRequest
return this;
}
//TODO: this does not belong here.
public ProjectBuilderConfiguration getProjectBuildingConfiguration()
{
if ( projectBuildingConfiguration == null )

View File

@ -29,7 +29,6 @@ import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.ProjectBuilderConfiguration;
import org.apache.maven.settings.Settings;
import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.util.dag.CycleDetectedException;
/**
@ -38,8 +37,6 @@ import org.codehaus.plexus.util.dag.CycleDetectedException;
*/
public class MavenSession
{
private PlexusContainer container;
private ReactorManager reactorManager;
private MavenExecutionRequest request;
@ -47,22 +44,20 @@ public class MavenSession
private MavenProject currentProject;
// Used by the embedder to verifyPlugin
public MavenSession( PlexusContainer container, MavenExecutionRequest request )
public MavenSession( MavenExecutionRequest request )
{
this.container = container;
this.request = request;
}
public MavenSession( PlexusContainer container, MavenExecutionRequest request, MavenProject project )
public MavenSession( MavenExecutionRequest request, MavenProject project )
throws CycleDetectedException, DuplicateProjectException
{
this( container, request, Arrays.asList( new MavenProject[]{ project } ) );
this( request, Arrays.asList( new MavenProject[]{ project } ) );
}
public MavenSession( PlexusContainer container, MavenExecutionRequest request, List<MavenProject> projects )
public MavenSession( MavenExecutionRequest request, List<MavenProject> projects )
throws CycleDetectedException, DuplicateProjectException
{
this.container = container;
this.request = request;
this.reactorManager = new ReactorManager( projects, request.getReactorFailureBehavior() );
this.currentProject = projects.get( 0 );
@ -77,11 +72,6 @@ public class MavenSession
return reactorManager.getPluginContext( pluginDescriptor, project );
}
public PlexusContainer getContainer()
{
return container;
}
public ArtifactRepository getLocalRepository()
{

View File

@ -99,7 +99,7 @@ public abstract class AbstractCoreMavenComponentTest
// We just need to use the configuration, and get the POM from that.
MavenProject project = projectBuilder.build( pom, configuration );
MavenSession session = new MavenSession( getContainer(), request, project );
MavenSession session = new MavenSession( request, project );
return session;
}

View File

@ -70,7 +70,7 @@ public class BuildExtensionListenerTest
ReactorManager rm = new ReactorManager( Collections.singletonList( project ), ReactorManager.FAIL_FAST );
MavenExecutionRequest request = new DefaultMavenExecutionRequest();
request.setLocalRepositoryPath( new File( System.getProperty( "user.home" ), ".m2/repository" ) );
MavenSession session = new MavenSession( getContainer(), request );
MavenSession session = new MavenSession( request );
return session;
}

View File

@ -348,7 +348,7 @@ public class PluginParameterExpressionEvaluatorTest
.setBaseDirectory( new File( "" ) )
.setLocalRepository( repo );
return new MavenSession( container, request );
return new MavenSession( request );
}
public void testLocalRepositoryExtraction()
@ -465,7 +465,7 @@ public class PluginParameterExpressionEvaluatorTest
ReactorManager rm = new ReactorManager( Collections.singletonList( project ), ReactorManager.FAIL_FAST );
MockControl mockMavenExecutionRequest = MockControl.createControl( MavenExecutionRequest.class );
MavenExecutionRequest req = (MavenExecutionRequest) mockMavenExecutionRequest.getMock();
MavenSession session = new MavenSession( getContainer(), req );
MavenSession session = new MavenSession( req );
return session;
}

View File

@ -89,6 +89,7 @@ public class MavenEmbedder
//
// ----------------------------------------------------------------------------
//TODO: this needs to be the standard container
private MutablePlexusContainer container;
// ----------------------------------------------------------------------
@ -274,7 +275,7 @@ public class MavenEmbedder
protected void verifyPlugin( Plugin plugin, MavenProject project )
throws ComponentLookupException, PluginLoaderException
{
MavenSession session = new MavenSession( container, request );
MavenSession session = new MavenSession( request );
pluginManager.loadPlugin( plugin, project, session );
}