Fix Maven/DefaultMaven method signatures, push projectSessions map into request.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@589822 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2007-10-29 19:42:33 +00:00
parent a1c2b00069
commit b97533f845
5 changed files with 41 additions and 16 deletions

View File

@ -102,13 +102,12 @@ public class DefaultMaven
// lifecycle execution // lifecycle execution
public ReactorManager createReactorManager( MavenExecutionRequest request, public ReactorManager createReactorManager( MavenExecutionRequest request,
MavenExecutionResult result, MavenExecutionResult result )
Map projectSessions )
{ {
List projects; List projects;
try try
{ {
projects = getProjects( request, projectSessions ); projects = getProjects( request );
if ( projects.isEmpty() ) if ( projects.isEmpty() )
{ {
@ -159,7 +158,7 @@ public class DefaultMaven
return reactorManager; return reactorManager;
} }
public MavenExecutionResult execute( MavenExecutionRequest request, Map projectSessions ) public MavenExecutionResult execute( MavenExecutionRequest request )
{ {
request.setStartTime( new Date() ); request.setStartTime( new Date() );
@ -167,8 +166,7 @@ public class DefaultMaven
ReactorManager reactorManager = createReactorManager( ReactorManager reactorManager = createReactorManager(
request, request,
result, result );
projectSessions );
if ( result.hasExceptions() ) if ( result.hasExceptions() )
{ {
@ -187,7 +185,7 @@ public class DefaultMaven
request, request,
reactorManager, reactorManager,
dispatcher, dispatcher,
projectSessions ); request.getProjectSessions() );
for ( Iterator i = request.getGoals().iterator(); i.hasNext(); ) for ( Iterator i = request.getGoals().iterator(); i.hasNext(); )
{ {
@ -262,7 +260,7 @@ public class DefaultMaven
systemContext.store( buildContextManager ); systemContext.store( buildContextManager );
} }
private List getProjects( MavenExecutionRequest request, Map projectSessions ) private List getProjects( MavenExecutionRequest request )
throws MavenExecutionException throws MavenExecutionException
{ {
List projects; List projects;
@ -283,7 +281,7 @@ public class DefaultMaven
// instances just-in-time. // instances just-in-time.
try try
{ {
buildExtensionScanner.scanForBuildExtensions( files, request.getLocalRepository(), request.getProfileManager(), projectSessions ); buildExtensionScanner.scanForBuildExtensions( files, request.getLocalRepository(), request.getProfileManager(), request.getProjectSessions() );
} }
catch ( ExtensionScanningException e ) catch ( ExtensionScanningException e )
{ {

View File

@ -23,8 +23,6 @@ import org.apache.maven.execution.MavenExecutionRequest;
import org.apache.maven.execution.MavenExecutionResult; import org.apache.maven.execution.MavenExecutionResult;
import org.apache.maven.execution.ReactorManager; import org.apache.maven.execution.ReactorManager;
import java.util.Map;
/** /**
* @author <a href="mailto:jason@maven.org">Jason van Zyl </a> * @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
* @version $Id$ * @version $Id$
@ -53,7 +51,7 @@ public interface Maven
static final int LOGGING_LEVEL_DISABLE = 5; static final int LOGGING_LEVEL_DISABLE = 5;
MavenExecutionResult execute( MavenExecutionRequest request, Map projectSessions ); MavenExecutionResult execute( MavenExecutionRequest request );
ReactorManager createReactorManager( MavenExecutionRequest request, MavenExecutionResult result, Map projectSessions ); ReactorManager createReactorManager( MavenExecutionRequest request, MavenExecutionResult result );
} }

View File

@ -28,7 +28,9 @@ import org.apache.maven.wagon.events.TransferListener;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Properties; import java.util.Properties;
/** /**
@ -60,6 +62,13 @@ public class DefaultMavenExecutionRequest
private boolean isProjectPresent = true; private boolean isProjectPresent = true;
/**
* These are {@link MavenProjectSession} instances, keyed by
* groupId:artifactId:version of the project, and used to lookup and store
* extension and plugin realms specific to that project.
*/
private Map projectSessions;
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// We need to allow per execution user and global settings as the embedder // We need to allow per execution user and global settings as the embedder
// might be running in a mode where its executing many threads with totally // might be running in a mode where its executing many threads with totally
@ -603,4 +612,20 @@ public class DefaultMavenExecutionRequest
{ {
return remoteRepositories; return remoteRepositories;
} }
public Map getProjectSessions()
{
if ( projectSessions == null )
{
projectSessions = new HashMap();
}
return projectSessions;
}
public MavenExecutionRequest setProjectSessions( Map projectSessions )
{
this.projectSessions = projectSessions;
return this;
}
} }

View File

@ -30,6 +30,7 @@ import org.codehaus.plexus.logging.Logger;
import java.io.File; import java.io.File;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Properties; import java.util.Properties;
/** /**
@ -194,7 +195,7 @@ public interface MavenExecutionRequest
boolean isProjectPresent(); boolean isProjectPresent();
MavenExecutionRequest setProjectPresent( boolean isProjectPresent ); MavenExecutionRequest setProjectPresent( boolean isProjectPresent );
File getUserSettingsFile(); File getUserSettingsFile();
MavenExecutionRequest setUserSettingsFile( File userSettingsFile ); MavenExecutionRequest setUserSettingsFile( File userSettingsFile );
File getGlobalSettingsFile(); File getGlobalSettingsFile();
@ -202,4 +203,7 @@ public interface MavenExecutionRequest
MavenExecutionRequest addRemoteRepository( ArtifactRepository repository ); MavenExecutionRequest addRemoteRepository( ArtifactRepository repository );
List getRemoteRepositories(); List getRemoteRepositories();
MavenExecutionRequest setProjectSessions( Map projectSessions );
Map getProjectSessions();
} }

View File

@ -490,7 +490,7 @@ public class MavenEmbedder
return result.addExtensionScanningException( e ); return result.addExtensionScanningException( e );
} }
ReactorManager reactorManager = maven.createReactorManager( request, result, projectSessions ); ReactorManager reactorManager = maven.createReactorManager( request, result );
if ( result.hasExceptions() ) if ( result.hasExceptions() )
{ {
@ -901,7 +901,7 @@ public class MavenEmbedder
return result; return result;
} }
return maven.execute( request, projectSessions ); return maven.execute( request );
} }
finally finally
{ {