mirror of https://github.com/apache/maven.git
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:
parent
d9ac548e59
commit
46c8c09a91
|
@ -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>
|
||||
|
|
|
@ -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().
|
||||
|
|
|
@ -144,7 +144,7 @@ public class DefaultMaven
|
|||
|
||||
try
|
||||
{
|
||||
session = new MavenSession( container, request, projects );
|
||||
session = new MavenSession( request, projects );
|
||||
|
||||
result.setReactorManager( session.getReactorManager() );
|
||||
}
|
||||
|
|
|
@ -676,6 +676,7 @@ public class DefaultMavenExecutionRequest
|
|||
return this;
|
||||
}
|
||||
|
||||
//TODO: this does not belong here.
|
||||
public ProjectBuilderConfiguration getProjectBuildingConfiguration()
|
||||
{
|
||||
if ( projectBuildingConfiguration == null )
|
||||
|
|
|
@ -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()
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue