maven-m2-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jvan...@apache.org
Subject cvs commit: maven-components/maven-core/src/test/java/org/apache/maven/plugin PluginParameterExpressionEvaluatorTest.java
Date Wed, 16 Feb 2005 07:16:33 GMT
jvanzyl     2005/02/15 23:16:33

  Modified:    maven-core/src/main/java/org/apache/maven DefaultMaven.java
               maven-core/src/main/java/org/apache/maven/cli MavenCli.java
               maven-core/src/main/java/org/apache/maven/execution
                        AbstractMavenExecutionRequest.java
                        MavenExecutionRequest.java
               maven-core/src/main/java/org/apache/maven/lifecycle/goal
                        MavenGoalExecutionContext.java
               maven-core/src/main/java/org/apache/maven/lifecycle/goal/phase
                        GoalAttainmentPhase.java GoalMappingPhase.java
                        GoalResolutionPhase.java PluginResolutionPhase.java
               maven-core/src/main/java/org/apache/maven/lifecycle/session/phase
                        GoalExecutionPhase.java
               maven-core/src/main/java/org/apache/maven/plugin
                        DefaultPluginManager.java PluginManager.java
                        PluginParameterExpressionEvaluator.java
               maven-core/src/main/java/org/apache/maven/util
                        AbstractGoalVisitor.java GoalVisitor.java
                        GoalWalker.java
               maven-core/src/main/resources/META-INF/plexus components.xml
               maven-core/src/test/java/org/apache/maven MavenTestCase.java
               maven-core/src/test/java/org/apache/maven/plugin
                        PluginParameterExpressionEvaluatorTest.java
  Added:       maven-core/src/main/java/org/apache/maven/execution
                        MavenInitializingExecutionRequest.java
                        MavenProjectExecutionRequest.java
                        MavenReactorExecutionRequest.java MavenSession.java
               maven-core/src/main/java/org/apache/maven/lifecycle
                        Phase.java
               maven-core/src/test/java/org/apache/maven/lifecycle
                        LifecycleExecutorTest.java
  Removed:     maven-core/src/main/java/org/apache/maven/execution
                        AbstractMavenExecutionRequestHandler.java
                        MavenExecutionRequestHandler.java
                        MavenSetupExecutionRequest.java
               maven-core/src/main/java/org/apache/maven/execution/initialize
                        MavenInitializingExecutionRequest.java
                        MavenInitializingExecutionRequestHandler.java
               maven-core/src/main/java/org/apache/maven/execution/manager
                        DefaultMavenExecutionRequestHandlerManager.java
                        MavenExecutionRequestHandlerManager.java
                        MavenExecutionRequestHandlerNotFoundException.java
               maven-core/src/main/java/org/apache/maven/execution/project
                        MavenProjectExecutionRequest.java
                        MavenProjectExecutionRequestHandler.java
               maven-core/src/main/java/org/apache/maven/execution/reactor
                        MavenReactorExecutionRequest.java
                        MavenReactorExecutionRequestHandler.java
               maven-core/src/main/java/org/apache/maven/lifecycle/session
                        MavenSession.java
               maven-core/src/test/java/org/apache/maven/execution/manager
                        MavenExecutionRequestHandlerManagerTest.java
  Log:
  o the introduction of the lifecycle stuff we've been chatting about so you
    can now do things like:
  
    m2 package
  
    which makes the jar
  
    m2 install
  
    which installs the jar
  
    m2 test
  
    You can also execute individual goals still like:
  
    clean:clean
    pom:install
    idea:idea
  
    Execution of goals this way will still have the dependency resolution
    flag obeyed but they are run in isolation in that pre/post goals don't
    exist anymore. You need to slot your mojos into the lifecycle.
  
    I will add the mechanism whereby configuring a plugin will push
    the mojo into the lifecycle.
  
  Revision  Changes    Path
  1.17      +326 -9    maven-components/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
  
  Index: DefaultMaven.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/DefaultMaven.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- DefaultMaven.java	25 Dec 2004 16:26:24 -0000	1.16
  +++ DefaultMaven.java	16 Feb 2005 07:16:31 -0000	1.17
  @@ -17,22 +17,44 @@
    * ====================================================================
    */
   
  +import org.apache.maven.artifact.manager.WagonManager;
  +import org.apache.maven.artifact.repository.ArtifactRepository;
   import org.apache.maven.execution.MavenExecutionRequest;
  -import org.apache.maven.execution.MavenExecutionRequestHandler;
   import org.apache.maven.execution.MavenExecutionResponse;
  -import org.apache.maven.execution.manager.MavenExecutionRequestHandlerManager;
  +import org.apache.maven.execution.MavenProjectExecutionRequest;
  +import org.apache.maven.execution.MavenReactorExecutionRequest;
  +import org.apache.maven.execution.MavenSession;
  +import org.apache.maven.lifecycle.LifecycleExecutor;
   import org.apache.maven.lifecycle.goal.GoalNotFoundException;
  +import org.apache.maven.lifecycle.session.MavenSessionPhaseManager;
  +import org.apache.maven.plugin.PluginManager;
  +import org.apache.maven.project.MavenProject;
  +import org.apache.maven.project.MavenProjectBuilder;
  +import org.apache.maven.project.ProjectBuildingException;
  +import org.apache.maven.reactor.ReactorException;
  +import org.codehaus.plexus.PlexusConstants;
  +import org.codehaus.plexus.PlexusContainer;
  +import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
  +import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
  +import org.codehaus.plexus.context.Context;
  +import org.codehaus.plexus.context.ContextException;
   import org.codehaus.plexus.i18n.I18N;
   import org.codehaus.plexus.logging.AbstractLogEnabled;
  +import org.codehaus.plexus.util.FileUtils;
  +
  +import java.io.File;
  +import java.util.ArrayList;
  +import java.util.Date;
  +import java.util.Iterator;
  +import java.util.List;
   
   /**
    * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
  - *
    * @version $Id$
    */
   public class DefaultMaven
       extends AbstractLogEnabled
  -    implements Maven
  +    implements Maven, Contextualizable
   {
       // ----------------------------------------------------------------------
       // Components
  @@ -40,7 +62,15 @@
   
       private I18N i18n;
   
  -    private MavenExecutionRequestHandlerManager requestHandlerManager;
  +    protected MavenProjectBuilder projectBuilder;
  +
  +    protected PluginManager pluginManager;
  +
  +    protected MavenSessionPhaseManager sessionPhaseManager;
  +
  +    protected LifecycleExecutor lifecycleExecutor;
  +
  +    protected PlexusContainer container;
   
       // ----------------------------------------------------------------------
       // Project execution
  @@ -49,12 +79,299 @@
       public MavenExecutionResponse execute( MavenExecutionRequest request )
           throws GoalNotFoundException, Exception
       {
  -        MavenExecutionRequestHandler handler = (MavenExecutionRequestHandler) requestHandlerManager.lookup( request.getType() );
  -
           MavenExecutionResponse response = new MavenExecutionResponse();
   
  -        handler.handle( request, response );
  +        handleProject( request );
   
           return response;
       }
  +
  +    public void handleProject( MavenExecutionRequest request )
  +        throws Exception
  +    {
  +        MavenExecutionResponse response = new MavenExecutionResponse();
  +
  +        MavenSession session = createSession( request );
  +
  +        MavenProject project = getProject( (File) request.getProjectFiles().get( 0 ), request.getLocalRepository() );
  +
  +        session.setProject( project );
  +
  +        try
  +        {
  +            response.setStart( new Date() );
  +
  +            resolveParameters( request );
  +
  +            lifecycleExecutor.execute( request.getGoals(), session );
  +
  +            response.setFinish( new Date() );
  +        }
  +        catch ( Exception e )
  +        {
  +            response.setFinish( new Date() );
  +
  +            response.setException( e );
  +
  +            logError( response );
  +
  +            return;
  +        }
  +
  +        if ( response.isExecutionFailure() )
  +        {
  +            logFailure( response );
  +        }
  +        else
  +        {
  +            logSuccess( response );
  +        }
  +    }
  +
  +    // ----------------------------------------------------------------------
  +    // Reactor
  +    // ----------------------------------------------------------------------
  +
  +    public void handleReactor( MavenExecutionRequest request, MavenExecutionResponse response )
  +        throws Exception
  +    {
  +        List projects = new ArrayList();
  +
  +        getLogger().info( "Starting the reactor..." );
  +
  +        try
  +        {
  +            List files = FileUtils.getFiles( new File( System.getProperty( "user.dir" ) ),
  +                                             ( (MavenReactorExecutionRequest) request ).getIncludes(),
  +                                             ( (MavenReactorExecutionRequest) request ).getExcludes() );
  +
  +            for ( Iterator iterator = files.iterator(); iterator.hasNext(); )
  +            {
  +                File file = (File) iterator.next();
  +
  +                MavenProject project = getProject( file, request.getLocalRepository() );
  +
  +                projects.add( project );
  +            }
  +
  +            projects = projectBuilder.getSortedProjects( projects );
  +        }
  +        catch ( Exception e )
  +        {
  +            throw new ReactorException( "Error processing projects for the reactor: ", e );
  +        }
  +
  +        getLogger().info( "Our processing order:" );
  +
  +        for ( Iterator iterator = projects.iterator(); iterator.hasNext(); )
  +        {
  +            MavenProject project = (MavenProject) iterator.next();
  +
  +            getLogger().info( project.getName() );
  +        }
  +
  +        for ( Iterator iterator = projects.iterator(); iterator.hasNext(); )
  +        {
  +            MavenProject project = (MavenProject) iterator.next();
  +
  +            System.out.println( "\n\n\n" );
  +
  +            line();
  +
  +            getLogger().info( "Building " + project.getName() );
  +
  +            line();
  +
  +            //MavenProjectExecutionRequest projectExecutionRequest = request.createProjectExecutionRequest( project );
  +
  +            //handleProject( projectExecutionRequest, response );
  +
  +            if ( response.isExecutionFailure() )
  +            {
  +                break;
  +            }
  +        }
  +    }
  +
  +    public MavenProject getProject( File pom, ArtifactRepository localRepository )
  +        throws ProjectBuildingException
  +    {
  +        if ( pom.exists() )
  +        {
  +            if ( pom.length() == 0 )
  +            {
  +                throw new ProjectBuildingException( i18n.format( "empty.descriptor.error", pom.getName() ) );
  +            }
  +        }
  +
  +        return projectBuilder.build( pom, localRepository );
  +    }
  +
  +    // ----------------------------------------------------------------------
  +    // Methods used by all execution request handlers
  +    // ----------------------------------------------------------------------
  +
  +    //!! We should probably have the execution request handler create the session as
  +    // the session type would be specific to the request i.e. having a project
  +    // or not.
  +
  +    protected MavenSession createSession( MavenExecutionRequest request )
  +        throws Exception
  +    {
  +        MavenSession session = new MavenSession( container,
  +                                                 pluginManager,
  +                                                 request.getLocalRepository(),
  +                                                 request.getGoals() );
  +
  +        return session;
  +    }
  +
  +    /**
  +     * @todo [BP] this might not be required if there is a better way to pass them in. It doesn't feel quite right.
  +     */
  +    private void resolveParameters( MavenExecutionRequest request )
  +        throws ComponentLookupException
  +    {
  +        WagonManager wagonManager = (WagonManager) container.lookup( WagonManager.ROLE );
  +
  +        if ( request.getParameter( "maven.proxy.http.host" ) != null )
  +        {
  +            String p = request.getParameter( "maven.proxy.http.port" );
  +            int port = 8080;
  +            if ( p != null )
  +            {
  +                try
  +                {
  +                    port = Integer.valueOf( p ).intValue();
  +                }
  +                catch ( NumberFormatException e )
  +                {
  +                    getLogger().warn( "maven.proxy.http.port was not valid" );
  +                }
  +            }
  +            wagonManager.setProxy( "http", request.getParameter( "maven.proxy.http.host" ), port,
  +                                   request.getParameter( "maven.proxy.http.username" ),
  +                                   request.getParameter( "maven.proxy.http.password" ),
  +                                   request.getParameter( "maven.proxy.http.nonProxyHosts" ) );
  +        }
  +    }
  +
  +    // ----------------------------------------------------------------------
  +    // Lifecylce Management
  +    // ----------------------------------------------------------------------
  +
  +    public void contextualize( Context context ) throws ContextException
  +    {
  +        container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
  +    }
  +
  +    // ----------------------------------------------------------------------
  +    // Reporting / Logging
  +    // ----------------------------------------------------------------------
  +
  +    protected void logError( MavenExecutionResponse r )
  +    {
  +        line();
  +
  +        getLogger().error( "BUILD ERROR" );
  +
  +        line();
  +
  +        getLogger().error( "Cause: ", r.getException() );
  +
  +        line();
  +
  +        stats( r.getStart(), r.getFinish() );
  +
  +        line();
  +    }
  +
  +    protected void logFailure( MavenExecutionResponse r )
  +    {
  +        line();
  +
  +        getLogger().info( "BUILD FAILURE" );
  +
  +        line();
  +
  +        getLogger().info( "Reason: " + r.getFailureResponse().shortMessage() );
  +
  +        line();
  +
  +        getLogger().info( r.getFailureResponse().longMessage() );
  +
  +        line();
  +
  +        stats( r.getStart(), r.getFinish() );
  +
  +        line();
  +    }
  +
  +    protected void logSuccess( MavenExecutionResponse r )
  +    {
  +        line();
  +
  +        getLogger().info( "BUILD SUCCESSFUL" );
  +
  +        line();
  +
  +        stats( r.getStart(), r.getFinish() );
  +
  +        line();
  +    }
  +
  +    protected void stats( Date start, Date finish )
  +    {
  +        long time = finish.getTime() - start.getTime();
  +
  +        getLogger().info( "Total time: " + formatTime( time ) );
  +
  +        getLogger().info( "Finished at: " + finish );
  +
  +        final long mb = 1024 * 1024;
  +
  +        System.gc();
  +
  +        Runtime r = Runtime.getRuntime();
  +
  +        getLogger().info( "Final Memory: " + ( ( r.totalMemory() - r.freeMemory() ) / mb ) + "M/" + ( r.totalMemory() / mb ) + "M" );
  +    }
  +
  +    protected void line()
  +    {
  +        getLogger().info( "----------------------------------------------------------------------------" );
  +    }
  +
  +    protected static String formatTime( long ms )
  +    {
  +        long secs = ms / 1000;
  +
  +        long min = secs / 60;
  +
  +        secs = secs % 60;
  +
  +        if ( min > 0 )
  +        {
  +            return min + " minutes " + secs + " seconds";
  +        }
  +        else
  +        {
  +            return secs + " seconds";
  +        }
  +    }
  +
  +    // ----------------------------------------------------------------------
  +    //
  +    // ----------------------------------------------------------------------
  +
  +    // ----------------------------------------------------------------------
  +    // Reactor
  +    // ----------------------------------------------------------------------
  +
  +    public List getSortedProjects( List projects )
  +        throws Exception
  +    {
  +        return projectBuilder.getSortedProjects( projects );
  +    }
  +
   }
  
  
  
  1.10      +45 -14    maven-components/maven-core/src/main/java/org/apache/maven/cli/MavenCli.java
  
  Index: MavenCli.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/cli/MavenCli.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- MavenCli.java	10 Feb 2005 07:09:57 -0000	1.9
  +++ MavenCli.java	16 Feb 2005 07:16:31 -0000	1.10
  @@ -26,13 +26,13 @@
   import org.apache.commons.cli.PosixParser;
   import org.apache.maven.Maven;
   import org.apache.maven.MavenConstants;
  -import org.apache.maven.artifact.repository.ArtifactRepository;
   import org.apache.maven.artifact.manager.WagonManager;
  +import org.apache.maven.artifact.repository.ArtifactRepository;
   import org.apache.maven.execution.MavenExecutionRequest;
   import org.apache.maven.execution.MavenExecutionResponse;
  -import org.apache.maven.execution.initialize.MavenInitializingExecutionRequest;
  -import org.apache.maven.execution.project.MavenProjectExecutionRequest;
  -import org.apache.maven.execution.reactor.MavenReactorExecutionRequest;
  +import org.apache.maven.execution.MavenInitializingExecutionRequest;
  +import org.apache.maven.execution.MavenProjectExecutionRequest;
  +import org.apache.maven.execution.MavenReactorExecutionRequest;
   import org.codehaus.classworlds.ClassWorld;
   import org.codehaus.plexus.embed.ArtifactEnabledEmbedder;
   
  @@ -47,17 +47,20 @@
   public class MavenCli
   {
       public static final String POMv4 = "pom.xml";
  +
       public static final String userHome = System.getProperty( "user.home" );
  +
       public static File userDir = new File( System.getProperty( "user.dir" ) );
   
       public static int main( String[] args, ClassWorld classWorld )
  -    throws Exception
  +        throws Exception
       {
           // ----------------------------------------------------------------------
           // Setup the command line parser
           // ----------------------------------------------------------------------
   
           CLIManager cliManager = new CLIManager();
  +
           CommandLine commandLine = cliManager.parse( args );
   
           // ----------------------------------------------------------------------
  @@ -69,7 +72,9 @@
           // ----------------------------------------------------------------------
   
           File userConfigurationDirectory = getUserConfigurationDirectory();
  +
           Properties mavenProperties = getMavenProperties( userConfigurationDirectory );
  +
           ArtifactRepository localRepository = getLocalRepository( mavenProperties, userConfigurationDirectory );
   
           // ----------------------------------------------------------------------
  @@ -100,27 +105,37 @@
           // ----------------------------------------------------------------------
   
           MavenExecutionRequest request = null;
  +
           File projectFile = new File( userDir, POMv4 );
  +
           if ( projectFile.exists() )
           {
               if ( commandLine.hasOption( CLIManager.REACTOR ) )
               {
                   String includes = System.getProperty( "maven.reactor.includes", "**/" + POMv4 );
  +
                   String excludes = System.getProperty( "maven.reactor.excludes", POMv4 );
  -                request = new MavenReactorExecutionRequest( localRepository, mavenProperties, commandLine.getArgList(),
  -                                                            includes, excludes, userDir );
  +
  +                request = new MavenReactorExecutionRequest( localRepository,
  +                                                            mavenProperties,
  +                                                            commandLine.getArgList(),
  +                                                            includes,
  +                                                            excludes,
  +                                                            userDir );
               }
               else
               {
  -                request = new MavenProjectExecutionRequest( localRepository, mavenProperties, commandLine.getArgList(),
  +                request = new MavenProjectExecutionRequest( localRepository,
  +                                                            mavenProperties,
  +                                                            commandLine.getArgList(),
                                                               projectFile );
               }
           }
           else
           {
  -            request = new MavenInitializingExecutionRequest( localRepository, mavenProperties,
  -                                                             commandLine.getArgList() );
  +            request = new MavenInitializingExecutionRequest( localRepository, mavenProperties, commandLine.getArgList() );
           }
  +
           MavenExecutionResponse response = new MavenExecutionResponse();
   
           // ----------------------------------------------------------------------
  @@ -129,12 +144,13 @@
           // ----------------------------------------------------------------------
   
           ArtifactEnabledEmbedder embedder = new ArtifactEnabledEmbedder();
  +
           embedder.start( classWorld );
   
           // TODO [BP]: doing this here as it is CLI specific, though it doesn't feel like the right place.
           WagonManager wagonManager = (WagonManager) embedder.lookup( WagonManager.ROLE );
  -        wagonManager.setDownloadMonitor( new ConsoleDownloadMonitor() );
   
  +        wagonManager.setDownloadMonitor( new ConsoleDownloadMonitor() );
   
           Maven maven = (Maven) embedder.lookup( Maven.ROLE );
   
  @@ -143,6 +159,7 @@
           // ----------------------------------------------------------------------
   
           response = maven.execute( request );
  +
           if ( response.isExecutionFailure() )
           {
               return 1;
  @@ -178,18 +195,24 @@
       private static void setCliProperty( String property )
       {
           String name = null;
  +
           String value = null;
  +
           int i = property.indexOf( "=" );
  +
           if ( i <= 0 )
           {
               name = property.trim();
  +
               value = "true";
           }
           else
           {
               name = property.substring( 0, i ).trim();
  +
               value = property.substring( i + 1 ).trim();
           }
  +
           System.setProperty( name, value );
       }
   
  @@ -200,13 +223,21 @@
       static class CLIManager
       {
           public static final char NO_BANNER = 'b';
  +
           public static final char SET_SYSTEM_PROPERTY = 'D';
  +
           public static final char WORK_OFFLINE = 'o';
  +
           public static final char REACTOR = 'r';
  +
           public static final char DEBUG = 'X';
  +
           public static final char HELP = 'h';
  +
           public static final char VERSION = 'v';
  +
           public static final char LIST_GOALS = 'g';
  +
           private Options options = null;
   
           public CLIManager()
  @@ -253,7 +284,7 @@
           }
   
           public CommandLine parse( String[] args )
  -        throws ParseException
  +            throws ParseException
           {
               CommandLineParser parser = new PosixParser();
               return parser.parse( options, args );
  @@ -288,7 +319,7 @@
           Properties mavenProperties = new Properties();
           File mavenPropertiesFile = new File( mavenHomeLocal, MavenConstants.MAVEN_PROPERTIES );
           try
  -              {
  +        {
               mavenProperties.load( new FileInputStream( mavenPropertiesFile ) );
           }
           catch ( Exception e )
  
  
  
  1.7       +8 -9      maven-components/maven-core/src/main/java/org/apache/maven/execution/AbstractMavenExecutionRequest.java
  
  Index: AbstractMavenExecutionRequest.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/execution/AbstractMavenExecutionRequest.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- AbstractMavenExecutionRequest.java	8 Feb 2005 10:32:45 -0000	1.6
  +++ AbstractMavenExecutionRequest.java	16 Feb 2005 07:16:32 -0000	1.7
  @@ -18,8 +18,6 @@
    */
   
   import org.apache.maven.artifact.repository.ArtifactRepository;
  -import org.apache.maven.execution.project.MavenProjectExecutionRequest;
  -import org.apache.maven.lifecycle.session.MavenSession;
   import org.apache.maven.project.MavenProject;
   
   import java.util.List;
  @@ -29,20 +27,26 @@
    * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
    * @version $Id$
    */
  -public class AbstractMavenExecutionRequest
  +public abstract class AbstractMavenExecutionRequest
   implements MavenExecutionRequest
   {
       /** @todo [BP] is this required? This hands off to MavenSession, but could be passed through the handler.handle function (+ createSession). */
       protected ArtifactRepository localRepository;
  +
       protected final Properties parameters;
  +
       protected List goals;
  +
       protected String type;
  +
       protected MavenSession session;
   
       public AbstractMavenExecutionRequest( ArtifactRepository localRepository, Properties parameters, List goals )
       {
           this.localRepository = localRepository;
  +
           this.parameters = parameters;
  +
           this.goals = goals;
       }
   
  @@ -79,9 +83,4 @@
       {
           this.session = session;
       }
  -
  -    public MavenProjectExecutionRequest createProjectExecutionRequest( MavenProject project )
  -    {
  -        return new MavenProjectExecutionRequest( getLocalRepository(), parameters, getGoals(), project.getFile() );
  -    }
   }
  
  
  
  1.5       +3 -4      maven-components/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java
  
  Index: MavenExecutionRequest.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- MavenExecutionRequest.java	3 Feb 2005 11:39:26 -0000	1.4
  +++ MavenExecutionRequest.java	16 Feb 2005 07:16:32 -0000	1.5
  @@ -18,8 +18,6 @@
    */
   
   import org.apache.maven.artifact.repository.ArtifactRepository;
  -import org.apache.maven.execution.project.MavenProjectExecutionRequest;
  -import org.apache.maven.lifecycle.session.MavenSession;
   import org.apache.maven.project.MavenProject;
   
   import java.util.List;
  @@ -42,5 +40,6 @@
   
       MavenSession getSession();
   
  -    MavenProjectExecutionRequest createProjectExecutionRequest( MavenProject project );
  +    List getProjectFiles()
  +        throws Exception;
   }
  
  
  
  1.1                  maven-components/maven-core/src/main/java/org/apache/maven/execution/MavenInitializingExecutionRequest.java
  
  Index: MavenInitializingExecutionRequest.java
  ===================================================================
  package org.apache.maven.execution;
  
  /* ====================================================================
   *   Copyright 2001-2004 The Apache Software Foundation.
   *
   *   Licensed under the Apache License, Version 2.0 (the "License");
   *   you may not use this file except in compliance with the License.
   *   You may obtain a copy of the License at
   *
   *       http://www.apache.org/licenses/LICENSE-2.0
   *
   *   Unless required by applicable law or agreed to in writing, software
   *   distributed under the License is distributed on an "AS IS" BASIS,
   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *   See the License for the specific language governing permissions and
   *   limitations under the License.
   * ====================================================================
   */
  
  import org.apache.maven.artifact.repository.ArtifactRepository;
  import org.apache.maven.execution.AbstractMavenExecutionRequest;
  
  import java.util.List;
  import java.util.Properties;
  
  /**
   * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
   * @version $Id: MavenInitializingExecutionRequest.java,v 1.1 2005/02/16 07:16:32 jvanzyl Exp $
   */
  public class MavenInitializingExecutionRequest
  extends AbstractMavenExecutionRequest
  {
      public MavenInitializingExecutionRequest( ArtifactRepository localRepository, Properties properties, List goals )
      {
          super( localRepository, properties, goals );
  
          type = "initializing";
      }
  
      public List getProjectFiles()
          throws Exception
      {
          return null;
      }
  }
  
  
  
  1.1                  maven-components/maven-core/src/main/java/org/apache/maven/execution/MavenProjectExecutionRequest.java
  
  Index: MavenProjectExecutionRequest.java
  ===================================================================
  package org.apache.maven.execution;
  
  /* ====================================================================
   *   Copyright 2001-2004 The Apache Software Foundation.
   *
   *   Licensed under the Apache License, Version 2.0 (the "License");
   *   you may not use this file except in compliance with the License.
   *   You may obtain a copy of the License at
   *
   *       http://www.apache.org/licenses/LICENSE-2.0
   *
   *   Unless required by applicable law or agreed to in writing, software
   *   distributed under the License is distributed on an "AS IS" BASIS,
   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *   See the License for the specific language governing permissions and
   *   limitations under the License.
   * ====================================================================
   */
  
  import org.apache.maven.artifact.repository.ArtifactRepository;
  import org.apache.maven.execution.AbstractMavenExecutionRequest;
  
  import java.io.File;
  import java.util.List;
  import java.util.Properties;
  import java.util.ArrayList;
  
  /**
   * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
   * @version $Id: MavenProjectExecutionRequest.java,v 1.1 2005/02/16 07:16:32 jvanzyl Exp $
   */
  public class MavenProjectExecutionRequest
  extends AbstractMavenExecutionRequest
  {
      private File pom;
  
      public MavenProjectExecutionRequest( ArtifactRepository localRepository,
                                           Properties properties,
                                           List goals,
                                           File pom )
      {
          super( localRepository, properties, goals );
  
          this.pom = pom;
  
          type = "project";
      }
  
      public File getPom()
      {
          return pom;
      }
  
      public List getProjectFiles()
          throws Exception
      {
          List files = new ArrayList();
  
          files.add( pom );
  
          return files;
      }
  }
  
  
  
  1.1                  maven-components/maven-core/src/main/java/org/apache/maven/execution/MavenReactorExecutionRequest.java
  
  Index: MavenReactorExecutionRequest.java
  ===================================================================
  package org.apache.maven.execution;
  
  /* ====================================================================
   *   Copyright 2001-2004 The Apache Software Foundation.
   *
   *   Licensed under the Apache License, Version 2.0 (the "License");
   *   you may not use this file except in compliance with the License.
   *   You may obtain a copy of the License at
   *
   *       http://www.apache.org/licenses/LICENSE-2.0
   *
   *   Unless required by applicable law or agreed to in writing, software
   *   distributed under the License is distributed on an "AS IS" BASIS,
   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *   See the License for the specific language governing permissions and
   *   limitations under the License.
   * ====================================================================
   */
  
  import org.apache.maven.artifact.repository.ArtifactRepository;
  import org.apache.maven.execution.AbstractMavenExecutionRequest;
  import org.codehaus.plexus.util.FileUtils;
  
  import java.io.File;
  import java.util.List;
  import java.util.Properties;
  
  /**
   * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
   * @version $Id: MavenReactorExecutionRequest.java,v 1.1 2005/02/16 07:16:32 jvanzyl Exp $
   */
  public class MavenReactorExecutionRequest
  extends AbstractMavenExecutionRequest
  {
      private String includes;
  
      private String excludes;
  
      private File baseDirectory;
  
      public MavenReactorExecutionRequest( ArtifactRepository localRepository, Properties properties, List goals,
                                           String includes, String excludes, File baseDirectory )
      {
          super( localRepository, properties, goals );
  
          this.includes = includes;
  
          this.excludes = excludes;
  
          this.baseDirectory = baseDirectory;
  
          type = "reactor";
      }
  
      public String getIncludes()
      {
          return includes;
      }
  
      public String getExcludes()
      {
          return excludes;
      }
  
      public File getBaseDirectory()
      {
          return baseDirectory;
      }
  
      public List getProjectFiles()
          throws Exception
      {
          List files = FileUtils.getFiles( new File( System.getProperty( "user.dir" ) ), includes, excludes );
  
          return files;
      }
  }
  
  
  
  1.1                  maven-components/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java
  
  Index: MavenSession.java
  ===================================================================
  package org.apache.maven.execution;
  
  /* ====================================================================
   *   Copyright 2001-2004 The Apache Software Foundation.
   *
   *   Licensed under the Apache License, Version 2.0 (the "License");
   *   you may not use this file except in compliance with the License.
   *   You may obtain a copy of the License at
   *
   *       http://www.apache.org/licenses/LICENSE-2.0
   *
   *   Unless required by applicable law or agreed to in writing, software
   *   distributed under the License is distributed on an "AS IS" BASIS,
   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *   See the License for the specific language governing permissions and
   *   limitations under the License.
   * ====================================================================
   */
  
  import org.apache.maven.artifact.repository.ArtifactRepository;
  import org.apache.maven.model.PostGoal;
  import org.apache.maven.model.PreGoal;
  import org.apache.maven.plugin.PluginManager;
  import org.apache.maven.project.MavenProject;
  import org.apache.maven.repository.RepositoryUtils;
  import org.codehaus.plexus.PlexusContainer;
  import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
  import org.codehaus.plexus.util.dag.CycleDetectedException;
  import org.codehaus.plexus.util.dag.DAG;
  import org.codehaus.plexus.util.dag.TopologicalSorter;
  import org.codehaus.plexus.util.dag.Vertex;
  
  import java.util.Iterator;
  import java.util.LinkedList;
  import java.util.List;
  import java.util.Map;
  import java.util.Set;
  import java.util.TreeMap;
  
  /**
   * @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
   * @version $Id: MavenSession.java,v 1.1 2005/02/16 07:16:32 jvanzyl Exp $
   */
  public class MavenSession
  {
      private PlexusContainer container;
  
      private MavenProject project;
  
      private ArtifactRepository localRepository;
  
      private PluginManager pluginManager;
  
      private Set remoteRepositories;
  
      private DAG dag;
  
      private List goals;
  
      private Map preGoalMappings;
  
      private Map postGoalMappings;
  
      public MavenSession( PlexusContainer container,
                           PluginManager pluginManager,
                           ArtifactRepository localRepository,
                           List goals )
      {
          this.container = container;
  
          this.pluginManager = pluginManager;
  
          this.localRepository = localRepository;
  
          this.dag = new DAG();
  
          this.goals = goals;
      }
  
      public PlexusContainer getContainer()
      {
          return container;
      }
  
      public PluginManager getPluginManager()
      {
          return pluginManager;
      }
  
      public MavenProject getProject()
      {
          return project;
      }
  
      public void setProject( MavenProject project )
      {
          this.project = project;
  
          // ----------------------------------------------------------------------
          // We only need these things to be done when we have a project.
          // ----------------------------------------------------------------------
  
          this.preGoalMappings = new TreeMap();
  
          this.postGoalMappings = new TreeMap();
  
          initGoalDecoratorMappings();
      }
  
      public ArtifactRepository getLocalRepository()
      {
          return localRepository;
      }
  
      public Set getRemoteRepositories()
      {
          if ( remoteRepositories == null )
          {
              remoteRepositories = RepositoryUtils.mavenToWagon( project.getRepositories() );
          }
  
          return remoteRepositories;
      }
  
      public List getGoals()
      {
          return goals;
      }
  
      // ----------------------------------------------------------------------
      //
      // ----------------------------------------------------------------------
  
      public Object lookup( String role )
          throws ComponentLookupException
      {
          return container.lookup( role );
      }
  
      public Object lookup( String role, String roleHint )
          throws ComponentLookupException
      {
          return container.lookup( role, roleHint );
      }
  
      public void release( Object component )
      {
          if ( component != null )
          {
              try
              {
                  container.release( component );
              }
              catch ( Exception e )
              {
                  //@todo what to do here?
              }
          }
      }
  
      //!! this should probably not be done here as there are request types that
      // have no project
  
      public List getPreGoals( String goal )
      {
          if ( project == null )
          {
              return null;
          }
  
          List result = (List) preGoalMappings.get( goal );
  
          return result;
      }
  
      public List getPostGoals( String goal )
      {
          if ( project == null )
          {
              return null;
          }
  
          List result = (List) postGoalMappings.get( goal );
  
          return result;
      }
  
      private void initGoalDecoratorMappings()
      {
          List allPreGoals = project.getPreGoals();
  
          for ( Iterator it = allPreGoals.iterator(); it.hasNext(); )
          {
              PreGoal preGoal = (PreGoal) it.next();
  
              List preGoalList = (List) preGoalMappings.get( preGoal.getName() );
  
              if ( preGoalList == null )
              {
                  preGoalList = new LinkedList();
  
                  preGoalMappings.put( preGoal.getName(), preGoalList );
              }
  
              preGoalList.add( preGoal.getAttain() );
          }
  
          List allPostGoals = project.getPostGoals();
  
          for ( Iterator it = allPostGoals.iterator(); it.hasNext(); )
          {
              PostGoal postGoal = (PostGoal) it.next();
  
              List postGoalList = (List) postGoalMappings.get( postGoal.getName() );
  
              if ( postGoalList == null )
              {
                  postGoalList = new LinkedList();
  
                  postGoalMappings.put( postGoal.getName(), postGoalList );
              }
  
              postGoalList.add( postGoal.getAttain() );
          }
      }
  
      public void addImpliedExecution( String goal, String implied )
          throws CycleDetectedException
      {
          dag.addEdge( goal, implied );
      }
      
      public void addSingleExecution( String goal )
      {
          dag.addVertex( goal );
      }
  
      public List getExecutionChain( String goal )
      {
          Vertex vertex = dag.getVertex( goal );
          
          List sorted = TopologicalSorter.sort( vertex );
          
          int goalIndex = sorted.indexOf( goal );
          
          List chainToHere = sorted.subList( 0, goalIndex + 1 );
          
          return chainToHere;
      }
  }
  
  
  1.1                  maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/Phase.java
  
  Index: Phase.java
  ===================================================================
  package org.apache.maven.lifecycle;
  
  /* ====================================================================
   *   Copyright 2001-2004 The Apache Software Foundation.
   *
   *   Licensed under the Apache License, Version 2.0 (the "License");
   *   you may not use this file except in compliance with the License.
   *   You may obtain a copy of the License at
   *
   *       http://www.apache.org/licenses/LICENSE-2.0
   *
   *   Unless required by applicable law or agreed to in writing, software
   *   distributed under the License is distributed on an "AS IS" BASIS,
   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *   See the License for the specific language governing permissions and
   *   limitations under the License.
   * ====================================================================
   */
  
  /**
   * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
   * @version $Id: Phase.java,v 1.1 2005/02/16 07:16:32 jvanzyl Exp $
   */
  public class Phase
  {
      String id;
  
      String goal;
  
      public String getId()
      {
          return id;
      }
  
      public String getGoal()
      {
          return goal;
      }
  }
  
  
  
  1.9       +1 -1      maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/goal/MavenGoalExecutionContext.java
  
  Index: MavenGoalExecutionContext.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/goal/MavenGoalExecutionContext.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- MavenGoalExecutionContext.java	25 Dec 2004 16:38:26 -0000	1.8
  +++ MavenGoalExecutionContext.java	16 Feb 2005 07:16:32 -0000	1.9
  @@ -18,7 +18,7 @@
    */
   
   import org.apache.maven.artifact.repository.ArtifactRepository;
  -import org.apache.maven.lifecycle.session.MavenSession;
  +import org.apache.maven.execution.MavenSession;
   import org.apache.maven.plugin.FailureResponse;
   import org.apache.maven.plugin.descriptor.MojoDescriptor;
   import org.apache.maven.project.MavenProject;
  
  
  
  1.12      +8 -168    maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/goal/phase/GoalAttainmentPhase.java
  
  Index: GoalAttainmentPhase.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/goal/phase/GoalAttainmentPhase.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- GoalAttainmentPhase.java	28 Dec 2004 20:50:33 -0000	1.11
  +++ GoalAttainmentPhase.java	16 Feb 2005 07:16:32 -0000	1.12
  @@ -20,11 +20,14 @@
   import org.apache.maven.lifecycle.goal.AbstractMavenGoalPhase;
   import org.apache.maven.lifecycle.goal.GoalExecutionException;
   import org.apache.maven.lifecycle.goal.MavenGoalExecutionContext;
  +import org.apache.maven.execution.MavenSession;
   import org.apache.maven.plugin.Plugin;
   import org.apache.maven.plugin.PluginConfigurationException;
   import org.apache.maven.plugin.PluginExecutionRequest;
   import org.apache.maven.plugin.PluginExecutionResponse;
   import org.apache.maven.plugin.PluginParameterExpressionEvaluator;
  +import org.apache.maven.plugin.DefaultPluginManager;
  +import org.apache.maven.plugin.PluginManager;
   import org.apache.maven.plugin.descriptor.MojoDescriptor;
   import org.apache.maven.plugin.descriptor.Parameter;
   import org.apache.maven.project.MavenProject;
  @@ -46,182 +49,19 @@
       public void execute( MavenGoalExecutionContext context )
           throws GoalExecutionException
       {
  -        PluginExecutionRequest request;
  -
           PluginExecutionResponse response;
   
           for ( Iterator it = context.getResolvedGoals().iterator(); it.hasNext(); )
           {
               String goalName = (String) it.next();
   
  -            MojoDescriptor mojoDescriptor = context.getMojoDescriptor( goalName );
  -
  -            getLogger().info( "[" + mojoDescriptor.getId() + "]" );
  -
  -            try
  -            {
  -                request = new PluginExecutionRequest( createParameters( mojoDescriptor, context ) );
  -            }
  -            catch ( PluginConfigurationException e )
  -            {
  -                throw new GoalExecutionException( "Error configuring plugin for execution.", e );
  -            }
  -
  -            response = new PluginExecutionResponse();
  -
  -            Plugin plugin = null;
  -
  -            try
  -            {
  -                String roleHint = context.getPluginId( mojoDescriptor );
  -
  -                plugin = (Plugin) context.lookup( Plugin.ROLE, roleHint );
  -
  -                plugin.execute( request, response );
  -
  -                if ( response.isExecutionFailure() )
  -                {
  -                    context.setExecutionFailure( mojoDescriptor.getId(), response.getFailureResponse() );
  -
  -                    break;
  -                }
  -            }
  -            catch ( ComponentLookupException e )
  -            {
  -                throw new GoalExecutionException( "Error looking up plugin: ", e );
  -            }
  -            catch ( Exception e )
  -            {
  -                throw new GoalExecutionException( "Error executing plugin: ", e );
  -            }
  -            finally
  -            {
  -                releaseComponents( mojoDescriptor, request, context );
  -
  -                context.release( plugin );
  -            }
  -        }
  -    }
  -
  -    private Map createParameters( MojoDescriptor goal, MavenGoalExecutionContext context )
  -        throws PluginConfigurationException
  -    {
  -        Map map = null;
  -
  -        List parameters = goal.getParameters();
  -
  -        if ( parameters != null )
  -        {
  -            map = new HashMap();
  -
  -            for ( int i = 0; i < parameters.size(); i++ )
  -            {
  -                Parameter parameter = (Parameter) parameters.get( i );
  -
  -                String key = parameter.getName();
  -
  -                String expression = parameter.getExpression();
  -
  -                Object value = PluginParameterExpressionEvaluator.evaluate( expression, context );
  -
  -                if ( value == null )
  -                {
  -                    if ( parameter.getDefaultValue() != null )
  -                    {
  -                        value = parameter.getDefaultValue();
  -                    }
  -                }
  -
  -                map.put( key, value );
  -            }
  -
  -            if ( context.getProject() != null )
  -            {
  -                map = mergeProjectDefinedPluginConfiguration( context.getProject(), goal.getId(), map );
  -            }
  -        }
  -
  -        for ( int i = 0; i < parameters.size(); i++ )
  -        {
  -            Parameter parameter = (Parameter) parameters.get( i );
  -
  -            String key = parameter.getName();
  -
  -            Object value = map.get( key );
  -
  -            // ----------------------------------------------------------------------
  -            // We will perform a basic check here for parameters values that are
  -            // required. Required parameters can't be null so we throw an
  -            // Exception in the case where they are. We probably want some pluggable
  -            // mechanism here but this will catch the most obvious of
  -            // misconfigurations.
  -            // ----------------------------------------------------------------------
  +            response = context.getSession().getPluginManager().executeMojo( context.getSession(), goalName );
   
  -            if ( value == null && parameter.isRequired() )
  +            if ( response.isExecutionFailure() )
               {
  -                throw new PluginConfigurationException( createPluginParameterRequiredMessage( goal, parameter ) );
  -            }
  -        }
  -
  -        return map;
  -    }
  -
  -    private Map mergeProjectDefinedPluginConfiguration( MavenProject project, String goalId, Map map )
  -    {
  -        // ----------------------------------------------------------------------
  -        // I would like to be able to lookup the Plugin object using a key but
  -        // we have a limitation in modello that will be remedied shortly. So
  -        // for now I have to iterate through and see what we have.
  -        // ----------------------------------------------------------------------
  -
  -        if ( project.getPlugins() != null )
  -        {
  -            String pluginId = goalId.substring( 0, goalId.indexOf( ":" ) );
  -
  -            for ( Iterator iterator = project.getPlugins().iterator(); iterator.hasNext(); )
  -            {
  -                org.apache.maven.model.Plugin plugin = (org.apache.maven.model.Plugin) iterator.next();
  -
  -                if ( pluginId.equals( plugin.getId() ) )
  -                {
  -                    return CollectionUtils.mergeMaps( plugin.getConfiguration(), map );
  -                }
  -            }
  -        }
  -
  -        return map;
  -    }
  -
  -    private String createPluginParameterRequiredMessage( MojoDescriptor mojo, Parameter parameter )
  -    {
  -        StringBuffer message = new StringBuffer();
  -
  -        message.append( "The '" + parameter.getName() ).
  -            append( "' parameter is required for the execution of the " ).
  -            append( mojo.getId() ).
  -            append( " mojo and cannot be null." );
  -
  -        return message.toString();
  -    }
  -
  -    private void releaseComponents( MojoDescriptor goal, PluginExecutionRequest request, MavenGoalExecutionContext context )
  -    {
  -        if ( request != null && request.getParameters() != null )
  -        {
  -            for ( Iterator iterator = goal.getParameters().iterator(); iterator.hasNext(); )
  -            {
  -                Parameter parameter = (Parameter) iterator.next();
  -
  -                String key = parameter.getName();
  -
  -                String expression = parameter.getExpression();
  -
  -                if ( expression != null & expression.startsWith( "#component" ) )
  -                {
  -                    Object component = request.getParameter( key );
  +                context.setExecutionFailure( goalName, response.getFailureResponse() );
   
  -                    context.release( component );
  -                }
  +                break;
               }
           }
       }
  
  
  
  1.9       +2 -1      maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/goal/phase/GoalMappingPhase.java
  
  Index: GoalMappingPhase.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/goal/phase/GoalMappingPhase.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- GoalMappingPhase.java	28 Dec 2004 19:43:20 -0000	1.8
  +++ GoalMappingPhase.java	16 Feb 2005 07:16:32 -0000	1.9
  @@ -20,11 +20,12 @@
   import org.apache.maven.lifecycle.goal.AbstractMavenGoalPhase;
   import org.apache.maven.lifecycle.goal.GoalExecutionException;
   import org.apache.maven.lifecycle.goal.MavenGoalExecutionContext;
  -import org.apache.maven.lifecycle.session.MavenSession;
  +import org.apache.maven.execution.MavenSession;
   import org.apache.maven.plugin.PluginManager;
   import org.apache.maven.util.AbstractGoalVisitor;
   import org.apache.maven.util.GoalWalker;
   import org.apache.maven.util.GraphTraversalException;
  +import org.apache.maven.execution.MavenSession;
   import org.codehaus.plexus.util.dag.CycleDetectedException;
   
   import java.util.HashSet;
  
  
  
  1.9       +3 -2      maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/goal/phase/GoalResolutionPhase.java
  
  Index: GoalResolutionPhase.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/goal/phase/GoalResolutionPhase.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- GoalResolutionPhase.java	25 Dec 2004 16:26:24 -0000	1.8
  +++ GoalResolutionPhase.java	16 Feb 2005 07:16:32 -0000	1.9
  @@ -20,11 +20,12 @@
   import org.apache.maven.lifecycle.goal.AbstractMavenGoalPhase;
   import org.apache.maven.lifecycle.goal.GoalExecutionException;
   import org.apache.maven.lifecycle.goal.MavenGoalExecutionContext;
  -import org.apache.maven.lifecycle.session.MavenSession;
  +import org.apache.maven.execution.MavenSession;
   import org.apache.maven.plugin.PluginManager;
   import org.apache.maven.util.AbstractGoalVisitor;
   import org.apache.maven.util.GoalWalker;
   import org.apache.maven.util.GraphTraversalException;
  +import org.apache.maven.execution.MavenSession;
   
   import java.util.LinkedList;
   import java.util.List;
  
  
  
  1.8       +2 -1      maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/goal/phase/PluginResolutionPhase.java
  
  Index: PluginResolutionPhase.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/goal/phase/PluginResolutionPhase.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- PluginResolutionPhase.java	28 Dec 2004 19:43:20 -0000	1.7
  +++ PluginResolutionPhase.java	16 Feb 2005 07:16:32 -0000	1.8
  @@ -20,11 +20,12 @@
   import org.apache.maven.lifecycle.goal.AbstractMavenGoalPhase;
   import org.apache.maven.lifecycle.goal.GoalExecutionException;
   import org.apache.maven.lifecycle.goal.MavenGoalExecutionContext;
  -import org.apache.maven.lifecycle.session.MavenSession;
  +import org.apache.maven.execution.MavenSession;
   import org.apache.maven.plugin.PluginManager;
   import org.apache.maven.util.AbstractGoalVisitor;
   import org.apache.maven.util.GoalWalker;
   import org.apache.maven.util.GraphTraversalException;
  +import org.apache.maven.execution.MavenSession;
   
   import java.util.HashSet;
   import java.util.Set;
  
  
  
  1.9       +2 -2      maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/session/phase/GoalExecutionPhase.java
  
  Index: GoalExecutionPhase.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/session/phase/GoalExecutionPhase.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- GoalExecutionPhase.java	25 Dec 2004 16:26:25 -0000	1.8
  +++ GoalExecutionPhase.java	16 Feb 2005 07:16:32 -0000	1.9
  @@ -22,7 +22,7 @@
   import org.apache.maven.lifecycle.goal.MavenGoalExecutionContext;
   import org.apache.maven.lifecycle.goal.MavenGoalPhaseManager;
   import org.apache.maven.lifecycle.session.AbstractMavenSessionPhase;
  -import org.apache.maven.lifecycle.session.MavenSession;
  +import org.apache.maven.execution.MavenSession;
   
   import java.util.Iterator;
   
  
  
  
  1.27      +207 -1    maven-components/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
  
  Index: DefaultPluginManager.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- DefaultPluginManager.java	8 Feb 2005 04:12:57 -0000	1.26
  +++ DefaultPluginManager.java	16 Feb 2005 07:16:32 -0000	1.27
  @@ -25,22 +25,28 @@
   import org.apache.maven.artifact.resolver.ArtifactResolver;
   import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
   import org.apache.maven.artifact.resolver.filter.ExclusionSetFilter;
  -import org.apache.maven.lifecycle.session.MavenSession;
  +import org.apache.maven.lifecycle.goal.GoalExecutionException;
  +import org.apache.maven.execution.MavenSession;
   import org.apache.maven.plugin.descriptor.MojoDescriptor;
  +import org.apache.maven.plugin.descriptor.Parameter;
   import org.apache.maven.plugin.descriptor.PluginDescriptor;
   import org.apache.maven.plugin.descriptor.PluginDescriptorBuilder;
  +import org.apache.maven.project.MavenProject;
   import org.apache.maven.project.MavenProjectBuilder;
  +import org.apache.maven.execution.MavenSession;
   import org.codehaus.plexus.ArtifactEnabledContainer;
   import org.codehaus.plexus.PlexusConstants;
   import org.codehaus.plexus.PlexusContainer;
   import org.codehaus.plexus.component.discovery.ComponentDiscoveryEvent;
   import org.codehaus.plexus.component.discovery.ComponentDiscoveryListener;
   import org.codehaus.plexus.component.repository.ComponentSetDescriptor;
  +import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
   import org.codehaus.plexus.context.Context;
   import org.codehaus.plexus.context.ContextException;
   import org.codehaus.plexus.logging.AbstractLogEnabled;
   import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
   import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
  +import org.codehaus.plexus.util.CollectionUtils;
   import org.codehaus.plexus.util.dag.CycleDetectedException;
   
   import java.util.HashMap;
  @@ -92,6 +98,14 @@
           return mojoDescriptors;
       }
   
  +    /**
  +     * Mojo descriptors are looked up using their id which is of the form
  +     * <pluginId>:<mojoId>. So this might be archetype:create for example which
  +     * is the create mojo that resides in the archetype plugin.
  +     *
  +     * @param name
  +     * @return
  +     */
       public MojoDescriptor getMojoDescriptor( String name )
       {
           return (MojoDescriptor) mojoDescriptors.get( name );
  @@ -225,6 +239,198 @@
                                                                  artifactFilter );
       }
   
  +    // ----------------------------------------------------------------------
  +    // Plugin execution
  +    // ----------------------------------------------------------------------
  +
  +    public PluginExecutionResponse executeMojo( MavenSession session, String goalName )
  +        throws GoalExecutionException
  +    {
  +        try
  +        {
  +            verifyPluginForGoal( goalName, session );
  +        }
  +        catch ( Exception e )
  +        {
  +            e.printStackTrace();
  +        }
  +
  +        PluginExecutionRequest request;
  +
  +        PluginExecutionResponse response;
  +
  +        MojoDescriptor mojoDescriptor = getMojoDescriptor( goalName );;
  +
  +        try
  +        {
  +            getLogger().info( "[" + mojoDescriptor.getId() + "]" );
  +
  +            request = new PluginExecutionRequest( DefaultPluginManager.createParameters( mojoDescriptor, session ) );
  +        }
  +        catch ( PluginConfigurationException e )
  +        {
  +            throw new GoalExecutionException( "Error configuring plugin for execution.", e );
  +        }
  +
  +        response = new PluginExecutionResponse();
  +
  +        Plugin plugin = null;
  +
  +        try
  +        {
  +            plugin = (Plugin) container.lookup( Plugin.ROLE, goalName );
  +
  +            plugin.execute( request, response );
  +
  +            releaseComponents( mojoDescriptor, request );
  +
  +            container.release( plugin );
  +        }
  +        catch ( ComponentLookupException e )
  +        {
  +            throw new GoalExecutionException( "Error looking up plugin: ", e );
  +        }
  +        catch ( Exception e )
  +        {
  +            throw new GoalExecutionException( "Error executing plugin: ", e );
  +        }
  +
  +        return response;
  +    }
  +
  +    private void releaseComponents( MojoDescriptor goal, PluginExecutionRequest request )
  +        throws Exception
  +    {
  +        if ( request != null && request.getParameters() != null )
  +        {
  +            for ( Iterator iterator = goal.getParameters().iterator(); iterator.hasNext(); )
  +            {
  +                Parameter parameter = (Parameter) iterator.next();
  +
  +                String key = parameter.getName();
  +
  +                String expression = parameter.getExpression();
  +
  +                if ( expression != null & expression.startsWith( "#component" ) )
  +                {
  +                    Object component = request.getParameter( key );
  +
  +                    container.release( component );
  +                }
  +            }
  +        }
  +    }
  +
  +    // ----------------------------------------------------------------------
  +    // Mojo Parameter Handling
  +    // ----------------------------------------------------------------------
  +
  +    public static Map createParameters( MojoDescriptor goal, MavenSession session )
  +        throws PluginConfigurationException
  +    {
  +        Map map = null;
  +
  +        List parameters = goal.getParameters();
  +
  +        if ( parameters != null )
  +        {
  +            map = new HashMap();
  +
  +            for ( int i = 0; i < parameters.size(); i++ )
  +            {
  +                Parameter parameter = (Parameter) parameters.get( i );
  +
  +                String key = parameter.getName();
  +
  +                String expression = parameter.getExpression();
  +
  +                Object value = PluginParameterExpressionEvaluator.evaluate( expression, session );
  +
  +                if ( value == null )
  +                {
  +                    if ( parameter.getDefaultValue() != null )
  +                    {
  +                        value = parameter.getDefaultValue();
  +                    }
  +                }
  +
  +                map.put( key, value );
  +            }
  +
  +            if ( session.getProject() != null )
  +            {
  +                map = mergeProjectDefinedPluginConfiguration( session.getProject(), goal.getId(), map );
  +            }
  +        }
  +
  +        for ( int i = 0; i < parameters.size(); i++ )
  +        {
  +            Parameter parameter = (Parameter) parameters.get( i );
  +
  +            String key = parameter.getName();
  +
  +            Object value = map.get( key );
  +
  +            // ----------------------------------------------------------------------
  +            // We will perform a basic check here for parameters values that are
  +            // required. Required parameters can't be null so we throw an
  +            // Exception in the case where they are. We probably want some pluggable
  +            // mechanism here but this will catch the most obvious of
  +            // misconfigurations.
  +            // ----------------------------------------------------------------------
  +
  +            if ( value == null && parameter.isRequired() )
  +            {
  +                throw new PluginConfigurationException( createPluginParameterRequiredMessage( goal, parameter ) );
  +            }
  +        }
  +
  +        return map;
  +    }
  +
  +    public static Map mergeProjectDefinedPluginConfiguration( MavenProject project, String goalId, Map map )
  +    {
  +        // ----------------------------------------------------------------------
  +        // I would like to be able to lookup the Plugin object using a key but
  +        // we have a limitation in modello that will be remedied shortly. So
  +        // for now I have to iterate through and see what we have.
  +        // ----------------------------------------------------------------------
  +
  +        if ( project.getPlugins() != null )
  +        {
  +            String pluginId = goalId.substring( 0, goalId.indexOf( ":" ) );
  +
  +            for ( Iterator iterator = project.getPlugins().iterator(); iterator.hasNext(); )
  +            {
  +                org.apache.maven.model.Plugin plugin = (org.apache.maven.model.Plugin) iterator.next();
  +
  +                if ( pluginId.equals( plugin.getId() ) )
  +                {
  +                    return CollectionUtils.mergeMaps( plugin.getConfiguration(), map );
  +                }
  +            }
  +        }
  +
  +        return map;
  +    }
  +
  +    public static String createPluginParameterRequiredMessage( MojoDescriptor mojo, Parameter parameter )
  +    {
  +        StringBuffer message = new StringBuffer();
  +
  +        message.append( "The '" + parameter.getName() ).
  +            append( "' parameter is required for the execution of the " ).
  +            append( mojo.getId() ).
  +            append( " mojo and cannot be null." );
  +
  +        return message.toString();
  +    }
  +
  +    // ----------------------------------------------------------------------
  +    // Lifecycle
  +    // ----------------------------------------------------------------------
  +
  +
       public void contextualize( Context context )
           throws ContextException
       {
  
  
  
  1.9       +7 -2      maven-components/maven-core/src/main/java/org/apache/maven/plugin/PluginManager.java
  
  Index: PluginManager.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/plugin/PluginManager.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- PluginManager.java	25 Dec 2004 16:26:25 -0000	1.8
  +++ PluginManager.java	16 Feb 2005 07:16:32 -0000	1.9
  @@ -17,8 +17,10 @@
    * ====================================================================
    */
   
  -import org.apache.maven.lifecycle.session.MavenSession;
  +import org.apache.maven.execution.MavenSession;
  +import org.apache.maven.lifecycle.goal.GoalExecutionException;
   import org.apache.maven.plugin.descriptor.MojoDescriptor;
  +import org.apache.maven.execution.MavenSession;
   
   import java.util.Map;
   
  @@ -30,6 +32,9 @@
   {
       String ROLE = PluginManager.class.getName();
   
  +    PluginExecutionResponse executeMojo( MavenSession session, String goalName )
  +         throws GoalExecutionException;
  +
       void processPluginDescriptor( MavenPluginDescriptor pluginDescriptor )
           throws Exception;
   
  
  
  
  1.7       +6 -5      maven-components/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java
  
  Index: PluginParameterExpressionEvaluator.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- PluginParameterExpressionEvaluator.java	3 Feb 2005 20:54:14 -0000	1.6
  +++ PluginParameterExpressionEvaluator.java	16 Feb 2005 07:16:32 -0000	1.7
  @@ -17,9 +17,10 @@
    * ====================================================================
    */
   
  -import org.apache.maven.lifecycle.goal.MavenGoalExecutionContext;
  +import org.apache.maven.execution.MavenSession;
   import org.apache.maven.project.MavenProject;
   import org.apache.maven.util.introspection.ReflectionValueExtractor;
  +import org.apache.maven.execution.MavenSession;
   import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
   
   /**
  @@ -28,7 +29,7 @@
    */
   public class PluginParameterExpressionEvaluator
   {
  -    public static Object evaluate( String expression, MavenGoalExecutionContext context )
  +    public static Object evaluate( String expression, MavenSession context )
           throws PluginConfigurationException
       {
           Object value = null;
  @@ -48,12 +49,12 @@
           }
           else if ( expression.equals( "#localRepository" ) )
           {
  -            value = context.getSession().getLocalRepository();
  +            value = context.getLocalRepository();
           }
           else if ( expression.equals( "#maven.repo.local" ) )
           {
               // TODO: remove this alias: but note that it is a string instead of an ArtifactRepository
  -            value = context.getSession().getLocalRepository().getUrl().substring( "file://".length() );
  +            value = context.getLocalRepository().getUrl().substring( "file://".length() );
           }
           else if ( expression.equals( "#maven.final.name" ) )
           {
  
  
  
  1.6       +2 -1      maven-components/maven-core/src/main/java/org/apache/maven/util/AbstractGoalVisitor.java
  
  Index: AbstractGoalVisitor.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/util/AbstractGoalVisitor.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- AbstractGoalVisitor.java	28 Dec 2004 19:09:31 -0000	1.5
  +++ AbstractGoalVisitor.java	16 Feb 2005 07:16:32 -0000	1.6
  @@ -17,7 +17,8 @@
    * ====================================================================
    */
   
  -import org.apache.maven.lifecycle.session.MavenSession;
  +import org.apache.maven.execution.MavenSession;
  +import org.apache.maven.execution.MavenSession;
   
   /**
    * @author jdcasey
  
  
  
  1.6       +1 -1      maven-components/maven-core/src/main/java/org/apache/maven/util/GoalVisitor.java
  
  Index: GoalVisitor.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/util/GoalVisitor.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- GoalVisitor.java	28 Dec 2004 19:08:51 -0000	1.5
  +++ GoalVisitor.java	16 Feb 2005 07:16:32 -0000	1.6
  @@ -17,7 +17,7 @@
    * ====================================================================
    */
   
  -import org.apache.maven.lifecycle.session.MavenSession;
  +import org.apache.maven.execution.MavenSession;
   
   /**
    * @author jdcasey
  
  
  
  1.7       +1 -1      maven-components/maven-core/src/main/java/org/apache/maven/util/GoalWalker.java
  
  Index: GoalWalker.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/util/GoalWalker.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- GoalWalker.java	28 Dec 2004 19:32:54 -0000	1.6
  +++ GoalWalker.java	16 Feb 2005 07:16:32 -0000	1.7
  @@ -17,7 +17,7 @@
    * ====================================================================
    */
   
  -import org.apache.maven.lifecycle.session.MavenSession;
  +import org.apache.maven.execution.MavenSession;
   import org.apache.maven.plugin.PluginManager;
   import org.apache.maven.plugin.descriptor.MojoDescriptor;
   
  
  
  
  1.10      +95 -64    maven-components/maven-core/src/main/resources/META-INF/plexus/components.xml
  
  Index: components.xml
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/resources/META-INF/plexus/components.xml,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- components.xml	3 Feb 2005 20:54:14 -0000	1.9
  +++ components.xml	16 Feb 2005 07:16:33 -0000	1.10
  @@ -13,34 +13,6 @@
             <role>org.codehaus.plexus.i18n.I18N</role>
           </requirement>
           <requirement>
  -          <role>org.apache.maven.execution.manager.MavenExecutionRequestHandlerManager</role>
  -        </requirement>
  -      </requirements>
  -    </component>
  -    <!--
  -     |
  -     |
  -     |
  -     -->
  -    <component>
  -      <role>org.apache.maven.execution.manager.MavenExecutionRequestHandlerManager</role>
  -      <implementation>org.apache.maven.execution.manager.DefaultMavenExecutionRequestHandlerManager</implementation>
  -      <requirements>
  -        <requirement>
  -          <role>org.apache.maven.execution.MavenExecutionRequestHandler</role>
  -          <field-name>handlers</field-name>
  -        </requirement>
  -      </requirements>
  -    </component>
  -    <component>
  -      <role>org.apache.maven.execution.MavenExecutionRequestHandler</role>
  -      <role-hint>project</role-hint>
  -      <implementation>org.apache.maven.execution.project.MavenProjectExecutionRequestHandler</implementation>
  -      <requirements>
  -        <requirement>
  -          <role>org.codehaus.plexus.i18n.I18N</role>
  -        </requirement>
  -        <requirement>
             <role>org.apache.maven.plugin.PluginManager</role>
           </requirement>
           <requirement>
  @@ -49,43 +21,8 @@
           <requirement>
             <role>org.apache.maven.lifecycle.session.MavenSessionPhaseManager</role>
           </requirement>
  -      </requirements>
  -    </component>
  -    <component>
  -      <role>org.apache.maven.execution.MavenExecutionRequestHandler</role>
  -      <role-hint>reactor</role-hint>
  -      <implementation>org.apache.maven.execution.reactor.MavenReactorExecutionRequestHandler</implementation>
  -      <requirements>
  -        <requirement>
  -          <role>org.codehaus.plexus.i18n.I18N</role>
  -        </requirement>
           <requirement>
  -          <role>org.apache.maven.plugin.PluginManager</role>
  -        </requirement>
  -        <requirement>
  -          <role>org.apache.maven.project.MavenProjectBuilder</role>
  -        </requirement>
  -        <requirement>
  -          <role>org.apache.maven.lifecycle.session.MavenSessionPhaseManager</role>
  -        </requirement>
  -      </requirements>
  -    </component>
  -1    <component>
  -      <role>org.apache.maven.execution.MavenExecutionRequestHandler</role>
  -      <role-hint>initializing</role-hint>
  -      <implementation>org.apache.maven.execution.initialize.MavenInitializingExecutionRequestHandler</implementation>
  -      <requirements>
  -        <requirement>
  -          <role>org.codehaus.plexus.i18n.I18N</role>
  -        </requirement>
  -        <requirement>
  -          <role>org.apache.maven.plugin.PluginManager</role>
  -        </requirement>
  -        <requirement>
  -          <role>org.apache.maven.project.MavenProjectBuilder</role>
  -        </requirement>
  -        <requirement>
  -          <role>org.apache.maven.lifecycle.session.MavenSessionPhaseManager</role>
  +          <role>org.apache.maven.lifecycle.LifecycleExecutor</role>
           </requirement>
         </requirements>
       </component>
  @@ -235,5 +172,99 @@
         <implementation>org.apache.maven.artifact.factory.DefaultArtifactFactory</implementation>
       </component>
   
  +    <!--
  +     |
  +     | Lifecycle executor
  +     |
  +     -->
  +    <component>
  +      <role>org.apache.maven.lifecycle.LifecycleExecutor</role>
  +      <implementation>org.apache.maven.lifecycle.DefaultLifecycleExecutor</implementation>
  +      <requirements>
  +        <requirement>
  +          <role>org.apache.maven.artifact.resolver.ArtifactResolver</role>
  +        </requirement>
  +        <requirement>
  +          <role>org.apache.maven.project.MavenProjectBuilder</role>
  +        </requirement>
  +        <requirement>
  +          <role>org.apache.maven.plugin.PluginManager</role>
  +        </requirement>
  +      </requirements>
  +      <configuration>
  +        <!-- START SNIPPET: lifecyle -->
  +        <phases>
  +          <!-- 1 -->
  +          <phase>
  +            <id>generate-sources</id>
  +          </phase>
  +          <!-- 2 -->
  +          <phase>
  +            <id>process-sources</id>
  +          </phase>
  +          <!-- 3 -->
  +          <phase>
  +            <id>generate-resources</id>
  +          </phase>
  +          <!-- 4 -->
  +          <phase>
  +            <id>process-resources</id>
  +            <goal>resources:resources</goal>
  +          </phase>
  +          <!-- 5 -->
  +          <phase>
  +            <id>compile</id>
  +            <goal>compiler:compile</goal>
  +          </phase>
  +          <!-- 6 -->
  +          <phase>
  +            <id>process-classes</id>
  +          </phase>
  +          <!-- 7 -->
  +          <phase>
  +            <id>generate-test-sources</id>
  +          </phase>
  +          <!-- 8 -->
  +          <phase>
  +            <id>process-test-sources</id>
  +          </phase>
  +          <!-- 9 -->
  +          <phase>
  +            <id>generate-test-sources</id>
  +          </phase>
  +          <!-- 10 -->
  +          <phase>
  +            <id>process-test-resources</id>
  +            <goal>resources:testResources</goal>
  +          </phase>
  +          <!-- 11 -->
  +          <phase>
  +            <id>test-compile</id>
  +            <goal>compiler:testCompile</goal>
  +          </phase>
  +          <!-- 12 -->
  +          <phase>
  +            <id>test</id>
  +            <goal>surefire:test</goal>
  +          </phase>
  +          <!-- 13 -->
  +          <phase>
  +            <id>package</id>
  +            <goal>jar:jar</goal>
  +          </phase>
  +          <!-- 14 -->
  +          <phase>
  +            <id>install</id>
  +            <goal>jar:install</goal>
  +          </phase>
  +          <!-- 15 -->
  +          <phase>
  +            <id>deploy</id>
  +            <goal>jar:deploy</goal>
  +          </phase>
  +        </phases>
  +        <!-- END SNIPPET: lifecycle -->
  +      </configuration>
  +    </component>
     </components>
   </component-set>
  
  
  
  1.14      +3 -2      maven-components/maven-core/src/test/java/org/apache/maven/MavenTestCase.java
  
  Index: MavenTestCase.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/test/java/org/apache/maven/MavenTestCase.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- MavenTestCase.java	25 Dec 2004 16:26:25 -0000	1.13
  +++ MavenTestCase.java	16 Feb 2005 07:16:33 -0000	1.14
  @@ -22,10 +22,11 @@
   
   import org.apache.maven.artifact.repository.ArtifactRepository;
   import org.apache.maven.lifecycle.goal.MavenGoalExecutionContext;
  -import org.apache.maven.lifecycle.session.MavenSession;
  +import org.apache.maven.execution.MavenSession;
   import org.apache.maven.plugin.PluginManager;
   import org.apache.maven.project.MavenProject;
   import org.apache.maven.project.MavenProjectBuilder;
  +import org.apache.maven.execution.MavenSession;
   
   import org.codehaus.plexus.ArtifactEnabledPlexusTestCase;
   
  
  
  
  1.1                  maven-components/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java
  
  Index: LifecycleExecutorTest.java
  ===================================================================
  package org.apache.maven.lifecycle;
  
  import org.apache.maven.MavenTestCase;
  
  /* ====================================================================
   *   Copyright 2001-2004 The Apache Software Foundation.
   *
   *   Licensed under the Apache License, Version 2.0 (the "License");
   *   you may not use this file except in compliance with the License.
   *   You may obtain a copy of the License at
   *
   *       http://www.apache.org/licenses/LICENSE-2.0
   *
   *   Unless required by applicable law or agreed to in writing, software
   *   distributed under the License is distributed on an "AS IS" BASIS,
   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *   See the License for the specific language governing permissions and
   *   limitations under the License.
   * ====================================================================
   */
  
  /**
   * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
   * @version $Id: LifecycleExecutorTest.java,v 1.1 2005/02/16 07:16:33 jvanzyl Exp $
   */
  public class LifecycleExecutorTest
      extends MavenTestCase
  {
      public void testLifecycleExecutor()
          throws Exception
      {
          LifecycleExecutor le = (LifecycleExecutor) lookup( LifecycleExecutor.ROLE );
  
          assertEquals( 15, le.getPhases().size() );
  
          //le.execute( "test", createGoalExecutionContext().getSession() );
      }
  }
  
  
  
  1.3       +4 -4      maven-components/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorTest.java
  
  Index: PluginParameterExpressionEvaluatorTest.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PluginParameterExpressionEvaluatorTest.java	23 Dec 2004 23:46:42 -0000	1.2
  +++ PluginParameterExpressionEvaluatorTest.java	16 Feb 2005 07:16:33 -0000	1.3
  @@ -34,7 +34,7 @@
       public void testValueExtractionWithAPomValueContainingAPath()
           throws Exception
       {
  -        Object value = PluginParameterExpressionEvaluator.evaluate( "#project.build.directory/classes", context );
  +        Object value = PluginParameterExpressionEvaluator.evaluate( "#project.build.directory/classes", context.getSession() );
   
           String expected = getTestFile( "target/test-classes/target/classes" ).getCanonicalPath();
   
  @@ -48,7 +48,7 @@
       {
           String role = "#component.org.apache.maven.project.MavenProjectBuilder";
   
  -        Object value = PluginParameterExpressionEvaluator.evaluate( role, context );
  +        Object value = PluginParameterExpressionEvaluator.evaluate( role, context.getSession() );
   
           assertNotNull( value );
       }
  @@ -56,7 +56,7 @@
       public void testLocalRepositoryExtraction()
           throws Exception
       {
  -        Object value = PluginParameterExpressionEvaluator.evaluate( "#localRepository", context );
  +        Object value = PluginParameterExpressionEvaluator.evaluate( "#localRepository", context.getSession() );
   
           assertEquals( "local", ((ArtifactRepository)value).getId() );
       }
  
  
  

Mime
View raw message