o changing MavenLifecycleContext to MavenGoalExecutionContext which is what

it really is. Making way for the notion of a MavenSessionExecutionContext
  and it is looking like we will end up with two lifecycles. Where we are
  dealing with notions of goals and sessions: some operations need to be
  done at the session level and don't need to be repeated for the execution
  of every goal.


git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@162968 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2004-08-12 18:41:15 +00:00
parent 133a51a629
commit e232e07440
17 changed files with 39 additions and 39 deletions

View File

@ -17,7 +17,7 @@ package org.apache.maven;
*/ */
import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.lifecycle.MavenLifecycleContext; import org.apache.maven.lifecycle.MavenGoalExecutionContext;
import org.apache.maven.lifecycle.MavenLifecycleManager; import org.apache.maven.lifecycle.MavenLifecycleManager;
import org.apache.maven.plugin.PluginManager; import org.apache.maven.plugin.PluginManager;
import org.apache.maven.plugin.descriptor.MojoDescriptor; import org.apache.maven.plugin.descriptor.MojoDescriptor;
@ -105,13 +105,13 @@ public class DefaultMaven
} }
*/ */
MavenLifecycleContext context; MavenGoalExecutionContext context;
try try
{ {
//!! we may not know anything about the plugin at this point. //!! we may not know anything about the plugin at this point.
context = new MavenLifecycleContext( container, context = new MavenGoalExecutionContext( container,
project, project,
getMojoDescriptor( goal ), getMojoDescriptor( goal ),
getLocalRepository() ); getLocalRepository() );

View File

@ -26,6 +26,6 @@ public abstract class AbstractMavenLifecyclePhase
extends AbstractLogEnabled extends AbstractLogEnabled
implements MavenLifecyclePhase implements MavenLifecyclePhase
{ {
public abstract void execute( MavenLifecycleContext context ) public abstract void execute( MavenGoalExecutionContext context )
throws Exception; throws Exception;
} }

View File

@ -36,7 +36,7 @@ public class DefaultMavenLifecycleManager
return lifecyclePhases; return lifecyclePhases;
} }
public void execute( MavenLifecycleContext context ) public void execute( MavenGoalExecutionContext context )
throws Exception throws Exception
{ {
for ( Iterator iterator = lifecyclePhases.iterator(); iterator.hasNext(); ) for ( Iterator iterator = lifecyclePhases.iterator(); iterator.hasNext(); )

View File

@ -18,7 +18,7 @@ import java.util.Set;
* @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$
*/ */
public class MavenLifecycleContext public class MavenGoalExecutionContext
{ {
private String failedGoal; private String failedGoal;
@ -44,7 +44,7 @@ public class MavenLifecycleContext
private String goalName; private String goalName;
public MavenLifecycleContext( PlexusContainer container, public MavenGoalExecutionContext( PlexusContainer container,
MavenProject project, MavenProject project,
MojoDescriptor goal, MojoDescriptor goal,
ArtifactRepository localRepository ) ArtifactRepository localRepository )

View File

@ -26,7 +26,7 @@ public interface MavenLifecycleManager
{ {
String ROLE = MavenLifecycleManager.class.getName(); String ROLE = MavenLifecycleManager.class.getName();
void execute( MavenLifecycleContext context ) void execute( MavenGoalExecutionContext context )
throws Exception; throws Exception;
List getLifecyclePhases(); List getLifecyclePhases();

View File

@ -27,7 +27,7 @@ public interface MavenLifecyclePhase
{ {
String ROLE = MavenLifecyclePhase.class.getName(); String ROLE = MavenLifecyclePhase.class.getName();
void execute( MavenLifecycleContext context ) void execute( MavenGoalExecutionContext context )
throws Exception; throws Exception;
void enableLogging( Logger logger ); void enableLogging( Logger logger );

View File

@ -19,7 +19,7 @@ package org.apache.maven.lifecycle.phase;
import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.resolver.ArtifactResolver; import org.apache.maven.artifact.resolver.ArtifactResolver;
import org.apache.maven.lifecycle.AbstractMavenLifecyclePhase; import org.apache.maven.lifecycle.AbstractMavenLifecyclePhase;
import org.apache.maven.lifecycle.MavenLifecycleContext; import org.apache.maven.lifecycle.MavenGoalExecutionContext;
import java.util.Iterator; import java.util.Iterator;
@ -30,7 +30,7 @@ import java.util.Iterator;
public class DependencyDownloadPhase public class DependencyDownloadPhase
extends AbstractMavenLifecyclePhase extends AbstractMavenLifecyclePhase
{ {
public void execute( MavenLifecycleContext context ) public void execute( MavenGoalExecutionContext context )
throws Exception throws Exception
{ {
ArtifactResolver artifactResolver = null; ArtifactResolver artifactResolver = null;

View File

@ -20,7 +20,7 @@ import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
import org.apache.maven.artifact.resolver.ArtifactResolver; import org.apache.maven.artifact.resolver.ArtifactResolver;
import org.apache.maven.artifact.MavenMetadataSource; import org.apache.maven.artifact.MavenMetadataSource;
import org.apache.maven.lifecycle.AbstractMavenLifecyclePhase; import org.apache.maven.lifecycle.AbstractMavenLifecyclePhase;
import org.apache.maven.lifecycle.MavenLifecycleContext; import org.apache.maven.lifecycle.MavenGoalExecutionContext;
import org.apache.maven.project.MavenProject; import org.apache.maven.project.MavenProject;
import java.util.Iterator; import java.util.Iterator;
@ -32,7 +32,7 @@ import java.util.Iterator;
public class DependencyResolutionPhase public class DependencyResolutionPhase
extends AbstractMavenLifecyclePhase extends AbstractMavenLifecyclePhase
{ {
public void execute( MavenLifecycleContext context ) public void execute( MavenGoalExecutionContext context )
throws Exception throws Exception
{ {
for ( Iterator iterator = context.getResolvedGoals().iterator(); iterator.hasNext(); ) for ( Iterator iterator = context.getResolvedGoals().iterator(); iterator.hasNext(); )
@ -48,7 +48,7 @@ public class DependencyResolutionPhase
} }
} }
private void resolveTransitiveDependencies( MavenLifecycleContext context ) private void resolveTransitiveDependencies( MavenGoalExecutionContext context )
throws Exception throws Exception
{ {
ArtifactResolver artifactResolver = null; ArtifactResolver artifactResolver = null;

View File

@ -17,7 +17,7 @@ package org.apache.maven.lifecycle.phase;
*/ */
import org.apache.maven.lifecycle.AbstractMavenLifecyclePhase; import org.apache.maven.lifecycle.AbstractMavenLifecyclePhase;
import org.apache.maven.lifecycle.MavenLifecycleContext; import org.apache.maven.lifecycle.MavenGoalExecutionContext;
import org.apache.maven.plugin.OgnlProjectValueExtractor; import org.apache.maven.plugin.OgnlProjectValueExtractor;
import org.apache.maven.plugin.Plugin; import org.apache.maven.plugin.Plugin;
import org.apache.maven.plugin.PluginExecutionRequest; import org.apache.maven.plugin.PluginExecutionRequest;
@ -37,7 +37,7 @@ import java.util.Map;
public class GoalAttainmentPhase public class GoalAttainmentPhase
extends AbstractMavenLifecyclePhase extends AbstractMavenLifecyclePhase
{ {
public void execute( MavenLifecycleContext context ) public void execute( MavenGoalExecutionContext context )
throws Exception throws Exception
{ {
PluginExecutionResponse response; PluginExecutionResponse response;
@ -82,7 +82,7 @@ public class GoalAttainmentPhase
} }
} }
private Map createParameters( MojoDescriptor goal, MavenLifecycleContext context ) private Map createParameters( MojoDescriptor goal, MavenGoalExecutionContext context )
{ {
Map map = null; Map map = null;
@ -115,7 +115,7 @@ public class GoalAttainmentPhase
return map; return map;
} }
private void releaseComponents( MojoDescriptor goal, PluginExecutionRequest request, MavenLifecycleContext context ) private void releaseComponents( MojoDescriptor goal, PluginExecutionRequest request, MavenGoalExecutionContext context )
{ {
if ( request != null && request.getParameters() != null ) if ( request != null && request.getParameters() != null )
{ {

View File

@ -19,7 +19,7 @@ package org.apache.maven.lifecycle.phase;
import org.apache.maven.decoration.GoalDecorationParser; import org.apache.maven.decoration.GoalDecorationParser;
import org.apache.maven.decoration.GoalDecoratorBindings; import org.apache.maven.decoration.GoalDecoratorBindings;
import org.apache.maven.lifecycle.AbstractMavenLifecyclePhase; import org.apache.maven.lifecycle.AbstractMavenLifecyclePhase;
import org.apache.maven.lifecycle.MavenLifecycleContext; import org.apache.maven.lifecycle.MavenGoalExecutionContext;
import org.apache.maven.project.MavenProject; import org.apache.maven.project.MavenProject;
import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlPullParserException;
@ -40,7 +40,7 @@ public class GoalDecorationPhase extends AbstractMavenLifecyclePhase
private GoalDecoratorBindings decorators; private GoalDecoratorBindings decorators;
private boolean decoratorsInitialized = false; private boolean decoratorsInitialized = false;
public void execute( MavenLifecycleContext context ) public void execute( MavenGoalExecutionContext context )
throws Exception throws Exception
{ {
synchronized ( this ) synchronized ( this )
@ -54,7 +54,7 @@ public class GoalDecorationPhase extends AbstractMavenLifecyclePhase
context.setGoalDecoratorBindings(decorators); context.setGoalDecoratorBindings(decorators);
} }
private void initializeDecorators( MavenLifecycleContext context ) private void initializeDecorators( MavenGoalExecutionContext context )
throws XmlPullParserException, IOException throws XmlPullParserException, IOException
{ {
MavenProject project = context.getProject( ); MavenProject project = context.getProject( );

View File

@ -21,7 +21,7 @@ import org.apache.maven.GoalNotFoundException;
import org.apache.maven.decoration.GoalDecorator; import org.apache.maven.decoration.GoalDecorator;
import org.apache.maven.decoration.GoalDecoratorBindings; import org.apache.maven.decoration.GoalDecoratorBindings;
import org.apache.maven.lifecycle.AbstractMavenLifecyclePhase; import org.apache.maven.lifecycle.AbstractMavenLifecyclePhase;
import org.apache.maven.lifecycle.MavenLifecycleContext; import org.apache.maven.lifecycle.MavenGoalExecutionContext;
import org.apache.maven.plugin.PluginManager; import org.apache.maven.plugin.PluginManager;
import org.apache.maven.plugin.descriptor.MojoDescriptor; import org.apache.maven.plugin.descriptor.MojoDescriptor;
@ -38,7 +38,7 @@ import java.util.Set;
*/ */
public class GoalResolutionPhase extends AbstractMavenLifecyclePhase public class GoalResolutionPhase extends AbstractMavenLifecyclePhase
{ {
public void execute( MavenLifecycleContext context ) public void execute( MavenGoalExecutionContext context )
throws Exception throws Exception
{ {
PluginManager pluginManager = null; PluginManager pluginManager = null;
@ -65,7 +65,7 @@ public class GoalResolutionPhase extends AbstractMavenLifecyclePhase
} }
} }
private List resolveTopLevel( String goal, Set includedGoals, List results, MavenLifecycleContext context, PluginManager pluginManager ) private List resolveTopLevel( String goal, Set includedGoals, List results, MavenGoalExecutionContext context, PluginManager pluginManager )
{ {
// Retrieve the prereqs-driven execution path for this goal, using the DAG. // Retrieve the prereqs-driven execution path for this goal, using the DAG.
@ -77,7 +77,7 @@ public class GoalResolutionPhase extends AbstractMavenLifecyclePhase
return resolveWithPrereqs( work, includedGoals, results, context, pluginManager ); return resolveWithPrereqs( work, includedGoals, results, context, pluginManager );
} }
private List resolveWithPrereqs( List work, Set includedGoals, List results, MavenLifecycleContext context, PluginManager pluginManager ) private List resolveWithPrereqs( List work, Set includedGoals, List results, MavenGoalExecutionContext context, PluginManager pluginManager )
{ {
if ( !work.isEmpty() ) if ( !work.isEmpty() )
{ {
@ -109,7 +109,7 @@ public class GoalResolutionPhase extends AbstractMavenLifecyclePhase
return results; return results;
} }
private List resolveGoalDecorators( List preGoals, Set includedGoals, List results, MavenLifecycleContext context, PluginManager pluginManager ) private List resolveGoalDecorators( List preGoals, Set includedGoals, List results, MavenGoalExecutionContext context, PluginManager pluginManager )
{ {
for ( Iterator it = preGoals.iterator(); it.hasNext(); ) for ( Iterator it = preGoals.iterator(); it.hasNext(); )
{ {

View File

@ -17,7 +17,7 @@ package org.apache.maven.lifecycle.phase;
*/ */
import org.apache.maven.lifecycle.AbstractMavenLifecyclePhase; import org.apache.maven.lifecycle.AbstractMavenLifecyclePhase;
import org.apache.maven.lifecycle.MavenLifecycleContext; import org.apache.maven.lifecycle.MavenGoalExecutionContext;
/** /**
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a> * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
@ -26,7 +26,7 @@ import org.apache.maven.lifecycle.MavenLifecycleContext;
public class InheritanceAssemblyPhase public class InheritanceAssemblyPhase
extends AbstractMavenLifecyclePhase extends AbstractMavenLifecyclePhase
{ {
public void execute( MavenLifecycleContext context ) public void execute( MavenGoalExecutionContext context )
throws Exception throws Exception
{ {
} }

View File

@ -17,7 +17,7 @@ package org.apache.maven.lifecycle.phase;
*/ */
import org.apache.maven.lifecycle.AbstractMavenLifecyclePhase; import org.apache.maven.lifecycle.AbstractMavenLifecyclePhase;
import org.apache.maven.lifecycle.MavenLifecycleContext; import org.apache.maven.lifecycle.MavenGoalExecutionContext;
import org.apache.maven.plugin.PluginManager; import org.apache.maven.plugin.PluginManager;
import org.apache.maven.plugin.descriptor.MojoDescriptor; import org.apache.maven.plugin.descriptor.MojoDescriptor;
@ -34,7 +34,7 @@ import org.apache.maven.plugin.descriptor.MojoDescriptor;
public class PluginDownloadPhase public class PluginDownloadPhase
extends AbstractMavenLifecyclePhase extends AbstractMavenLifecyclePhase
{ {
public void execute( MavenLifecycleContext context ) public void execute( MavenGoalExecutionContext context )
throws Exception throws Exception
{ {
PluginManager pluginManager = (PluginManager) context.lookup( PluginManager.ROLE ); PluginManager pluginManager = (PluginManager) context.lookup( PluginManager.ROLE );

View File

@ -18,7 +18,7 @@ package org.apache.maven.plugin;
import ognl.Ognl; import ognl.Ognl;
import ognl.OgnlException; import ognl.OgnlException;
import org.apache.maven.lifecycle.MavenLifecycleContext; import org.apache.maven.lifecycle.MavenGoalExecutionContext;
import org.codehaus.plexus.component.repository.exception.ComponentLookupException; import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
/** /**
@ -27,7 +27,7 @@ import org.codehaus.plexus.component.repository.exception.ComponentLookupExcepti
*/ */
public class OgnlProjectValueExtractor public class OgnlProjectValueExtractor
{ {
public static Object evaluate( String expression, MavenLifecycleContext context ) public static Object evaluate( String expression, MavenGoalExecutionContext context )
{ {
Object value = null; Object value = null;

View File

@ -20,7 +20,7 @@ package org.apache.maven.lifecycle.phase;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.decoration.GoalDecoratorBindings; import org.apache.maven.decoration.GoalDecoratorBindings;
import org.apache.maven.lifecycle.MavenLifecycleContext; import org.apache.maven.lifecycle.MavenGoalExecutionContext;
import org.apache.maven.model.Model; import org.apache.maven.model.Model;
import org.apache.maven.plugin.descriptor.MojoDescriptor; import org.apache.maven.plugin.descriptor.MojoDescriptor;
import org.apache.maven.project.MavenProject; import org.apache.maven.project.MavenProject;
@ -95,7 +95,7 @@ public class GoalDecorationPhaseTest extends TestCase
ArtifactRepository localRepository = new ArtifactRepository(); ArtifactRepository localRepository = new ArtifactRepository();
MavenLifecycleContext context = new MavenLifecycleContext( embedder.getContainer(), MavenGoalExecutionContext context = new MavenGoalExecutionContext( embedder.getContainer(),
project, project,
descriptor, descriptor,
localRepository ); localRepository );

View File

@ -5,7 +5,7 @@ import junit.framework.TestCase;
import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.decoration.DefaultGoalDecorator; import org.apache.maven.decoration.DefaultGoalDecorator;
import org.apache.maven.decoration.GoalDecoratorBindings; import org.apache.maven.decoration.GoalDecoratorBindings;
import org.apache.maven.lifecycle.MavenLifecycleContext; import org.apache.maven.lifecycle.MavenGoalExecutionContext;
import org.apache.maven.model.Model; import org.apache.maven.model.Model;
import org.apache.maven.plugin.PluginManager; import org.apache.maven.plugin.PluginManager;
import org.apache.maven.plugin.descriptor.MojoDescriptor; import org.apache.maven.plugin.descriptor.MojoDescriptor;
@ -292,7 +292,7 @@ public class GoalResolutionPhaseTest extends TestCase
ArtifactRepository localRepository = new ArtifactRepository(); ArtifactRepository localRepository = new ArtifactRepository();
MavenLifecycleContext context = new MavenLifecycleContext( embedder.getContainer(), MavenGoalExecutionContext context = new MavenGoalExecutionContext( embedder.getContainer(),
project, project,
descriptor, descriptor,
localRepository ); localRepository );

View File

@ -2,7 +2,7 @@ package org.apache.maven.plugin;
import org.apache.maven.MavenTestCase; import org.apache.maven.MavenTestCase;
import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.lifecycle.MavenLifecycleContext; import org.apache.maven.lifecycle.MavenGoalExecutionContext;
import org.apache.maven.project.MavenProject; import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectBuilder; import org.apache.maven.project.MavenProjectBuilder;
@ -19,7 +19,7 @@ public class OgnlProjectValueExtractorTest
private MavenProjectBuilder builder; private MavenProjectBuilder builder;
private MavenLifecycleContext context; private MavenGoalExecutionContext context;
protected void setUp() protected void setUp()
throws Exception throws Exception
@ -34,7 +34,7 @@ public class OgnlProjectValueExtractorTest
project.setProperty( "foo", "bar" ); project.setProperty( "foo", "bar" );
context = new MavenLifecycleContext( getContainer(), project, null, new ArtifactRepository( "foo", "http://bar" ) ); context = new MavenGoalExecutionContext( getContainer(), project, null, new ArtifactRepository( "foo", "http://bar" ) );
} }
public void testPropertyValueExtraction() public void testPropertyValueExtraction()