maven-m2-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdca...@apache.org
Subject cvs commit: maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/goal MavenGoalExecutionContext.java
Date Thu, 26 Aug 2004 04:40:02 GMT
jdcasey     2004/08/25 21:40:02

  Modified:    maven-core/src/main/resources/META-INF/plexus components.xml
               .        mboot.jar
               maven-core/src/main/java/org/apache/maven/plugin
                        DefaultPluginManager.java
               maven-core/src/main/java/org/apache/maven/lifecycle/session/phase
                        GoalExecutionPhase.java
               maven-core/src/test/java/org/apache/maven MavenTestCase.java
               maven-core/src/test/java/org/apache/maven/lifecycle
                        MavenLifecycleManagerTest.java
               maven-core-it/it0006 pom.xml goals.txt
               maven-core/src/main/java/org/apache/maven/lifecycle/goal/phase
                        GoalResolutionPhase.java
               maven-core pom.xml
               maven-core/src/test/resources/META-INF/maven plugin.xml
               maven-core/src/main/java/org/apache/maven DefaultMaven.java
               maven-core/src/test/java/org/apache/maven/lifecycle/goal/phase
                        GoalResolutionPhaseTest.java
               maven-artifact/src/main/java/org/apache/maven/artifact/handler/manager
                        DefaultArtifactHandlerManager.java
               maven-core/src/main/java/org/apache/maven/lifecycle/goal
                        MavenGoalExecutionContext.java
  Removed:     maven-core/src/test/java/org/apache/maven/decoration
                        GoalDecorationParserTest.java
                        DefaultGoalDecoratorTest.java
                        GoalDecoratorBindingsTest.java
               maven-core/src/main/java/org/apache/maven/decoration
                        GoalDecorationParser.java GoalDecorator.java
                        DefaultGoalDecorator.java
                        GoalDecoratorBindings.java
               maven-core-it/it0006 decorators.xml
               maven-core/src/main/java/org/apache/maven/lifecycle/goal/phase
                        GoalDecorationPhase.java PluginDownloadPhase.java
  Log:
  o Removed GoalDecorationPhase, since goal decoration is now a part of the model
  o Removed PluginDownloadPhase, since plugin resolution/download has to be a part of the prereq and pre/postGoal resolution, too
  o Changed DefaultMaven to execute the session lifecycle, and the component wiring to likewise wire the DefaultMaven with a session lifecycle manager
  o Removed the org.apache.maven.decoration package and its contents, since this is all in the model now
  o Fixed the GoalResolutionPhase to verify each goal's plugin in turn as it resolves prereqs, preGoals and postGoals
  o Fixed the GoalResolutionPhaseTest to work with the new resolution model
  o Added a new createGoalExecutionContext to the MavenTestCase base class, to allow me to inject a MavenProject directly rather than a pom file
  o Fixed the MavenLifecycleManagerTest to only expect 4 lifecycle phases, now than the plugin resolution and goal decoration phases are obsoleted
  o All builds on local machine, but will depend on plexus-0.17.jar/pom and plexus-artifact-container-1.0-alpha-1.jar/pom to build on beaver
  o I uploaded plexus-artifact-container-1.0-alpha-1.jar to ${plexus.home}/dist, but cannot upload POMs due to priveleges problem in poms dir.
  
  Revision  Changes    Path
  1.3       +2 -9      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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- components.xml	15 Aug 2004 15:01:51 -0000	1.2
  +++ components.xml	26 Aug 2004 04:39:51 -0000	1.3
  @@ -14,7 +14,7 @@
             <role>org.codehaus.plexus.i18n.I18N</role>
           </requirement>
           <requirement>
  -          <role>org.apache.maven.lifecycle.goal.MavenGoalPhaseManager</role>
  +          <role>org.apache.maven.lifecycle.session.MavenSessionPhaseManager</role>
           </requirement>
         </requirements>
       </component>
  @@ -30,12 +30,7 @@
         <implementation>org.apache.maven.lifecycle.session.DefaultMavenSessionPhaseManager</implementation>
         <configuration>
           <lifecycle-phases>
  -          <lifecycle-phase implementation="org.apache.maven.lifecycle.goal.phase.PluginDownloadPhase"/>
  -          <lifecycle-phase implementation="org.apache.maven.lifecycle.goal.phase.GoalDecorationPhase"/>
  -          <lifecycle-phase implementation="org.apache.maven.lifecycle.goal.phase.GoalResolutionPhase"/>
  -          <lifecycle-phase implementation="org.apache.maven.lifecycle.goal.phase.DependencyResolutionPhase"/>
  -          <lifecycle-phase implementation="org.apache.maven.lifecycle.goal.phase.DependencyDownloadPhase"/>
  -          <lifecycle-phase implementation="org.apache.maven.lifecycle.goal.phase.GoalAttainmentPhase"/>
  +          <lifecycle-phase implementation="org.apache.maven.lifecycle.session.phase.GoalExecutionPhase"/>
           </lifecycle-phases>
         </configuration>
       </component>
  @@ -44,8 +39,6 @@
         <implementation>org.apache.maven.lifecycle.goal.DefaultMavenGoalPhaseManager</implementation>
         <configuration>
           <lifecycle-phases>
  -          <lifecycle-phase implementation="org.apache.maven.lifecycle.goal.phase.PluginDownloadPhase"/>
  -          <lifecycle-phase implementation="org.apache.maven.lifecycle.goal.phase.GoalDecorationPhase"/>
             <lifecycle-phase implementation="org.apache.maven.lifecycle.goal.phase.GoalResolutionPhase"/>
             <lifecycle-phase implementation="org.apache.maven.lifecycle.goal.phase.DependencyResolutionPhase"/>
             <lifecycle-phase implementation="org.apache.maven.lifecycle.goal.phase.DependencyDownloadPhase"/>
  
  
  
  1.18      +40 -40    maven-components/mboot.jar
  
  	<<Binary file>>
  
  
  1.5       +39 -51    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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DefaultPluginManager.java	26 Aug 2004 01:18:14 -0000	1.4
  +++ DefaultPluginManager.java	26 Aug 2004 04:39:53 -0000	1.5
  @@ -1,19 +1,14 @@
   package org.apache.maven.plugin;
   
   /*
  - * 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.
  + * 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.Artifact;
  @@ -111,8 +106,7 @@
   
       private Set pluginsInProcess = new HashSet();
   
  -    public void processPluginDescriptor( MavenPluginDescriptor mavenPluginDescriptor )
  -        throws CycleDetectedException
  +    public void processPluginDescriptor( MavenPluginDescriptor mavenPluginDescriptor ) throws CycleDetectedException
       {
           if ( pluginsInProcess.contains( mavenPluginDescriptor.getPluginId() ) )
           {
  @@ -152,8 +146,7 @@
           }
       }
   
  -    private boolean processEdge( String mojoId, String prereq )
  -        throws CycleDetectedException
  +    private boolean processEdge( String mojoId, String prereq ) throws CycleDetectedException
       {
           dag.addEdge( mojoId, prereq );
   
  @@ -191,7 +184,7 @@
       {
           ComponentSetDescriptor componentSetDescriptor = event.getComponentSetDescriptor();
   
  -        if ( !( componentSetDescriptor instanceof MavenPluginDescriptor ) )
  +        if ( !(componentSetDescriptor instanceof MavenPluginDescriptor) )
           {
               return;
           }
  @@ -214,7 +207,7 @@
   
       public boolean isPluginInstalled( String pluginId )
       {
  -        return ( pluginDescriptors.get( pluginId ) != null );
  +        return (pluginDescriptors.get( pluginId ) != null);
       }
   
       private String getPluginId( String goalName )
  @@ -227,14 +220,14 @@
           return goalName;
       }
   
  -    public void verifyPluginForGoal( String goalName )
  -        throws Exception
  +    public void verifyPluginForGoal( String goalName ) throws Exception
       {
           String pluginId = getPluginId( goalName );
   
           if ( !isPluginInstalled( pluginId ) )
           {
  -            //!! This is entirely crappy. We need a better naming for plugin artifact ids and
  +            //!! This is entirely crappy. We need a better naming for plugin
  +            // artifact ids and
               //   we definitely need better version extraction support.
   
               String artifactId = "maven-" + pluginId + "-plugin";
  @@ -244,47 +237,43 @@
               Artifact pluginArtifact = new DefaultArtifact( "maven", artifactId, version, "plugin", "jar" );
   
               addPlugin( pluginArtifact );
  +
  +            // Now, we need to resolve the plugins for this goal's prereqs.
  +            MojoDescriptor mojoDescriptor = getMojoDescriptor( goalName );
  +
  +            List prereqs = mojoDescriptor.getPrereqs();
  +
  +            if ( prereqs != null )
  +            {
  +                for ( Iterator it = prereqs.iterator(); it.hasNext(); )
  +                {
  +                    String prereq = (String) it.next();
  +
  +                    verifyPluginForGoal( prereq );
  +                }
  +            }
           }
       }
   
  -    public void addPlugin( Artifact pluginArtifact )
  -        throws Exception
  +    public void addPlugin( Artifact pluginArtifact ) throws Exception
       {
           artifactResolver = (ArtifactResolver) container.lookup( ArtifactResolver.ROLE );
   
  -        MavenMetadataSource sr = new MavenMetadataSource( remotePluginRepositories,
  -                                                          localRepository,
  -                                                          artifactResolver );
  +        MavenMetadataSource sr = new MavenMetadataSource( remotePluginRepositories, localRepository, artifactResolver );
   
  -        String[] excludes = new String[]
  -        {
  -            "maven-core",
  -            "maven-artifact",
  -            "maven-model",
  -            "maven-plugin",
  -            "plexus",
  -            "xstream",
  -            "xpp3",
  -            "classworlds",
  -            "ognl"
  -        };
  -
  -        container.addComponent( pluginArtifact,
  -                                artifactResolver,
  -                                remotePluginRepositories,
  -                                localRepository,
  -                                sr,
  -                                excludes );
  +        String[] excludes = new String[] { "maven-core", "maven-artifact", "maven-model", "maven-plugin", "plexus",
  +            "xstream", "xpp3", "classworlds", "ognl" };
  +
  +        container.addComponent( pluginArtifact, artifactResolver, remotePluginRepositories, localRepository, sr,
  +            excludes );
       }
   
  -    public void contextualize( Context context )
  -        throws ContextException
  +    public void contextualize( Context context ) throws ContextException
       {
           container = (ArtifactEnabledContainer) context.get( PlexusConstants.PLEXUS_KEY );
       }
   
  -    public void initialize()
  -        throws Exception
  +    public void initialize() throws Exception
       {
           //!! move this to be configurable from the Maven component
           remotePluginRepositories = new HashSet();
  @@ -302,5 +291,4 @@
           this.localRepository = localRepository;
       }
   }
  -
   
  
  
  
  1.2       +4 -5      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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- GoalExecutionPhase.java	15 Aug 2004 15:01:51 -0000	1.1
  +++ GoalExecutionPhase.java	26 Aug 2004 04:39:53 -0000	1.2
  @@ -25,14 +25,13 @@
   import java.util.Iterator;
   
   /**
  - * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
  + * @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
    * @version $Id$
    */
   public class GoalExecutionPhase
       extends AbstractMavenSessionPhase
   {
  -    public void execute( MavenSession session )
  -        throws Exception
  +    public void execute( MavenSession session ) throws Exception
       {
           MavenGoalPhaseManager lifecycleManager = (MavenGoalPhaseManager) session.lookup( MavenGoalPhaseManager.ROLE );
   
  @@ -58,4 +57,4 @@
               }
           }
       }
  -}
  +}
  \ No newline at end of file
  
  
  
  1.5       +36 -17    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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- MavenTestCase.java	26 Aug 2004 01:18:16 -0000	1.4
  +++ MavenTestCase.java	26 Aug 2004 04:39:53 -0000	1.5
  @@ -33,7 +33,7 @@
   import java.util.List;
   
   /**
  - * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
  + * @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
    * @version $Id$
    */
   public class MavenTestCase
  @@ -43,18 +43,32 @@
   
       protected MavenProjectBuilder projectBuilder;
   
  -    protected void setUp()
  -        throws Exception
  +    protected String testRepoUrl;
  +
  +    protected void setUp() throws Exception
       {
           super.setUp();
   
  +        File testRepoLocation = new File( "target/repo" );
  +        if ( !testRepoLocation.exists() )
  +        {
  +            testRepoLocation.mkdirs();
  +        }
  +
  +        testRepoUrl = testRepoLocation.toURL().toExternalForm();
  +        testRepoUrl = testRepoUrl.substring( 0, testRepoUrl.length() - 1 );
  +
           pluginManager = (PluginManager) lookup( PluginManager.ROLE );
   
           projectBuilder = (MavenProjectBuilder) lookup( MavenProjectBuilder.ROLE );
       }
   
  -    protected void customizeContext()
  -        throws Exception
  +    protected String getTestRepoURL()
  +    {
  +        return testRepoUrl;
  +    }
  +
  +    protected void customizeContext() throws Exception
       {
           ClassWorld classWorld = new ClassWorld();
   
  @@ -64,31 +78,28 @@
   
           getContainer().addContextValue( "maven.home", new File( getBasedir(), "target/maven.home" ).getPath() );
   
  -        getContainer().addContextValue( "maven.home.local", new File( getBasedir(), "target/maven.home.local" ).getPath() );
  +        getContainer().addContextValue( "maven.home.local",
  +            new File( getBasedir(), "target/maven.home.local" ).getPath() );
       }
   
  -    protected MavenGoalExecutionContext createGoalExecutionContext()
  -        throws Exception
  +    protected MavenGoalExecutionContext createGoalExecutionContext() throws Exception
       {
           return createGoalExecutionContext( null, null );
       }
   
  -    protected MavenGoalExecutionContext createGoalExecutionContext( File pom )
  -        throws Exception
  +    protected MavenGoalExecutionContext createGoalExecutionContext( File pom ) throws Exception
       {
           return createGoalExecutionContext( pom, null );
       }
   
  -    protected MavenGoalExecutionContext createGoalExecutionContext( String goal )
  -        throws Exception
  +    protected MavenGoalExecutionContext createGoalExecutionContext( String goal ) throws Exception
       {
           return createGoalExecutionContext( null, goal );
       }
   
  -    protected MavenGoalExecutionContext createGoalExecutionContext( File pom, String goal )
  -        throws Exception
  +    protected MavenGoalExecutionContext createGoalExecutionContext( File pom, String goal ) throws Exception
       {
  -        ArtifactRepository localRepository = new ArtifactRepository( "local", "file://" );
  +        ArtifactRepository localRepository = new ArtifactRepository( "local", testRepoUrl );
   
           MavenProject project;
   
  @@ -103,12 +114,20 @@
               project = projectBuilder.build( f, localRepository );
           }
   
  +        return createGoalExecutionContext( project, localRepository, goal );
  +    }
  +
  +    protected MavenGoalExecutionContext createGoalExecutionContext( MavenProject project,
  +        ArtifactRepository localRepository, String goal )
  +    {
           project.setProperty( "foo", "bar" );
   
           List goals = new ArrayList();
   
           MavenSession session = new MavenSession( getContainer(), pluginManager, project, localRepository, goals );
   
  +        pluginManager.setLocalRepository( localRepository );
  +
           MojoDescriptor descriptor;
   
           if ( goal != null )
  @@ -124,4 +143,4 @@
   
           return context;
       }
  -}
  +}
  \ No newline at end of file
  
  
  
  1.3       +6 -6      maven-components/maven-core/src/test/java/org/apache/maven/lifecycle/MavenLifecycleManagerTest.java
  
  Index: MavenLifecycleManagerTest.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/test/java/org/apache/maven/lifecycle/MavenLifecycleManagerTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MavenLifecycleManagerTest.java	15 Aug 2004 15:01:51 -0000	1.2
  +++ MavenLifecycleManagerTest.java	26 Aug 2004 04:39:54 -0000	1.3
  @@ -6,19 +6,19 @@
   import java.util.List;
   
   /**
  - * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
  - * @version $Id$
  + * @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
  + * @version $Id: MavenLifecycleManagerTest.java,v 1.2 2004/08/15 15:01:51
  + *          jvanzyl Exp $
    */
   public class MavenLifecycleManagerTest
       extends MavenTestCase
   {
  -    public void testMavenLifecycleManager()
  -        throws Exception
  +    public void testMavenLifecycleManager() throws Exception
       {
           MavenGoalPhaseManager mlm = (MavenGoalPhaseManager) lookup( MavenGoalPhaseManager.ROLE );
   
           List lifecyclePhases = mlm.getLifecyclePhases();
   
  -        assertEquals( 6, lifecyclePhases.size() );
  +        assertEquals( 4, lifecyclePhases.size() );
       }
  -}
  +}
  \ No newline at end of file
  
  
  
  1.2       +14 -0     maven-components/maven-core-it/it0006/pom.xml
  
  Index: pom.xml
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core-it/it0006/pom.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- pom.xml	19 Jul 2004 00:58:14 -0000	1.1
  +++ pom.xml	26 Aug 2004 04:39:54 -0000	1.2
  @@ -11,4 +11,18 @@
         <type>test</type>
       </dependency>
     </dependencies>  
  +  
  +  <preGoals>
  +    <preGoal>
  +        <name>compiler:compile</name>
  +        <attain>clean:clean</attain>
  +    </preGoal>
  +  </preGoals>
  +  
  +  <postGoals>
  +    <postGoal>
  +        <name>compiler:compile</name>
  +        <attain>jar:jar</attain>
  +    </postGoal>
  +  </postGoals>
   </project>
  
  
  
  1.2       +1 -1      maven-components/maven-core-it/it0006/goals.txt
  
  Index: goals.txt
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core-it/it0006/goals.txt,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- goals.txt	19 Jul 2004 00:58:14 -0000	1.1
  +++ goals.txt	26 Aug 2004 04:39:55 -0000	1.2
  @@ -1 +1 @@
  -jar:jar
  +compiler:compile
  
  
  
  1.2       +62 -34    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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- GoalResolutionPhase.java	15 Aug 2004 15:01:51 -0000	1.1
  +++ GoalResolutionPhase.java	26 Aug 2004 04:39:56 -0000	1.2
  @@ -1,6 +1,5 @@
   package org.apache.maven.lifecycle.goal.phase;
   
  -
   /*
    * Copyright 2001-2004 The Apache Software Foundation.
    *
  @@ -18,12 +17,13 @@
    */
   
   import org.apache.maven.lifecycle.goal.GoalNotFoundException;
  -import org.apache.maven.decoration.GoalDecorator;
  -import org.apache.maven.decoration.GoalDecoratorBindings;
   import org.apache.maven.lifecycle.goal.AbstractMavenGoalPhase;
   import org.apache.maven.lifecycle.goal.MavenGoalExecutionContext;
   import org.apache.maven.lifecycle.goal.MavenGoalExecutionContext;
   import org.apache.maven.lifecycle.goal.GoalExecutionException;
  +import org.apache.maven.model.GoalDecorator;
  +import org.apache.maven.model.PostGoal;
  +import org.apache.maven.model.PreGoal;
   import org.apache.maven.plugin.PluginManager;
   import org.apache.maven.plugin.descriptor.MojoDescriptor;
   
  @@ -35,31 +35,37 @@
   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$
    */
  -public class GoalResolutionPhase extends AbstractMavenGoalPhase
  +public class GoalResolutionPhase
  +    extends AbstractMavenGoalPhase
   {
  -    public void execute( MavenGoalExecutionContext context )
  -        throws GoalExecutionException
  +    public void execute( MavenGoalExecutionContext context ) throws GoalExecutionException
       {
           PluginManager pluginManager = context.getSession().getPluginManager();
   
           try
           {
               // First, start by retrieving the currently-requested goal.
  -            MojoDescriptor goalDescriptor = context.getMojoDescriptor();
  +            String goal = context.getGoalName();
  +
  +            List resolvedGoals = resolveTopLevel( goal, new HashSet(), new LinkedList(), context, pluginManager );
   
  -            if ( goalDescriptor == null )
  +            context.setResolvedGoals( resolvedGoals );
  +
  +            if ( goal.indexOf( ":" ) < 0 )
               {
  -                throw new GoalNotFoundException( context.getGoalName() );
  +                goal = context.getProject().getType() + ":" + goal;
               }
   
  -            String goal = goalDescriptor.getId();
  +            MojoDescriptor md = pluginManager.getMojoDescriptor( goal );
   
  -            List resolvedGoals = resolveTopLevel( goal, new HashSet(), new LinkedList(), context, pluginManager );
  -
  -            context.setResolvedGoals( resolvedGoals );
  +            context.setMojoDescriptor( md );
  +        }
  +        catch ( Exception e )
  +        {
  +            throw new GoalExecutionException( "Error resolving goals: ", e );
           }
           finally
           {
  @@ -67,19 +73,26 @@
           }
       }
   
  -    private List resolveTopLevel( String goal, Set includedGoals, List results, MavenGoalExecutionContext context, PluginManager pluginManager )
  +    private List resolveTopLevel( String goal, Set includedGoals, List results, MavenGoalExecutionContext context,
  +        PluginManager pluginManager ) throws Exception
       {
   
  -        // Retrieve the prereqs-driven execution path for this goal, using the DAG.
  +        // Ensure that the plugin for this goal is installed.
  +        pluginManager.verifyPluginForGoal( goal );
  +
  +        // Retrieve the prereqs-driven execution path for this goal, using the
  +        // DAG.
           List work = pluginManager.getGoals( goal );
   
  -        // Reverse the original goals list to preserve encapsulation while decorating.
  +        // Reverse the original goals list to preserve encapsulation while
  +        // decorating.
           Collections.reverse( work );
   
           return resolveWithPrereqs( work, includedGoals, results, context, pluginManager );
       }
   
  -    private List resolveWithPrereqs( List work, Set includedGoals, List results, MavenGoalExecutionContext context, PluginManager pluginManager )
  +    private List resolveWithPrereqs( List work, Set includedGoals, List results, MavenGoalExecutionContext context,
  +        PluginManager pluginManager ) throws Exception
       {
           if ( !work.isEmpty() )
           {
  @@ -89,38 +102,53 @@
   
               if ( descriptor.alwaysExecute() || !includedGoals.contains( goal ) )
               {
  -                GoalDecoratorBindings bindings = context.getGoalDecoratorBindings();
  -                if ( bindings != null )
  +                List preGoals = new LinkedList();
  +                List allPreGoals = context.getProject().getModel().getPreGoals();
  +                for ( Iterator it = allPreGoals.iterator(); it.hasNext(); )
                   {
  -                    List preGoals = bindings.getPreGoals( goal );
  -
  -                    results = resolveGoalDecorators( preGoals, includedGoals, results, context, pluginManager );
  +                    PreGoal preGoal = (PreGoal) it.next();
  +                    if ( goal.equals( preGoal.getName() ) )
  +                    {
  +                        preGoals.add( preGoal.getAttain() );
  +                    }
                   }
   
  +                results = resolveGoalDecorators( goal, true, includedGoals, results, context, pluginManager );
  +
                   results = resolveWithPrereqs( work, includedGoals, results, context, pluginManager );
                   includedGoals.add( goal );
                   results.add( goal );
   
  -                if ( bindings != null )
  -                {
  -                    List postGoals = bindings.getPostGoals( goal );
  -                    results = resolveGoalDecorators( postGoals, includedGoals, results, context, pluginManager );
  -                }
  +                results = resolveGoalDecorators( goal, false, includedGoals, results, context, pluginManager );
               }
           }
           return results;
       }
   
  -    private List resolveGoalDecorators( List preGoals, Set includedGoals, List results, MavenGoalExecutionContext context, PluginManager pluginManager )
  +    private List resolveGoalDecorators( String baseGoal, boolean usePreGoals, Set includedGoals, List results,
  +        MavenGoalExecutionContext context, PluginManager pluginManager ) throws Exception
       {
  -        for ( Iterator it = preGoals.iterator(); it.hasNext(); )
  +        List decorators = null;
  +        if ( usePreGoals )
  +        {
  +            decorators = context.getProject().getModel().getPreGoals();
  +        }
  +        else
  +        {
  +            decorators = context.getProject().getModel().getPostGoals();
  +        }
  +
  +        for ( Iterator it = decorators.iterator(); it.hasNext(); )
           {
               GoalDecorator decorator = (GoalDecorator) it.next();
  -            String goal = decorator.getDecoratorGoal();
  -            resolveTopLevel( goal, includedGoals, results, context, pluginManager );
  +            if ( baseGoal.equals( decorator.getName() ) )
  +            {
  +                String goal = decorator.getAttain();
  +                resolveTopLevel( goal, includedGoals, results, context, pluginManager );
  +            }
           }
   
           return results;
       }
   
  -}
  +}
  \ No newline at end of file
  
  
  
  1.4       +0 -11     maven-components/maven-core/pom.xml
  
  Index: pom.xml
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/pom.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- pom.xml	26 Aug 2004 01:18:18 -0000	1.3
  +++ pom.xml	26 Aug 2004 04:39:57 -0000	1.4
  @@ -52,17 +52,6 @@
         <artifactId>ognl</artifactId>
         <version>2.5.1</version>
       </dependency>
  -    <!-- Used to support maven.xml script and goal decorating in general. -->
  -    <dependency>
  -      <groupId>marmalade</groupId>
  -      <artifactId>marmalade-core</artifactId>
  -      <version>0.1</version>
  -    </dependency>
  -    <dependency>
  -      <groupId>marmalade</groupId>
  -      <artifactId>marmalade-el-ognl</artifactId>
  -      <version>0.1</version>
  -    </dependency>
       <!-- Wagon -->
       <dependency>
         <groupId>maven</groupId>
  
  
  
  1.2       +22 -22    maven-components/maven-core/src/test/resources/META-INF/maven/plugin.xml
  
  Index: plugin.xml
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/test/resources/META-INF/maven/plugin.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- plugin.xml	9 Aug 2004 19:02:40 -0000	1.1
  +++ plugin.xml	26 Aug 2004 04:39:58 -0000	1.2
  @@ -1,19 +1,19 @@
   <plugin>
  -  <id>decorTest</id>
  +  <id>resolveTest</id>
     <mojos>
       <!-- Test main with preGoal and postGoal -->
       <mojo>
  -      <id>t1:preGoal</id>
  +      <id>resolveTest:t1-preGoal</id>
         <implementation>org.apache.maven.plugin.GoalDecorationAndResolutionTestPlugin</implementation>
         <instantiationStrategy>singleton</instantiationStrategy>
       </mojo>
       <mojo>
  -      <id>t1:main</id>
  +      <id>resolveTest:t1-main</id>
         <implementation>org.apache.maven.plugin.GoalDecorationAndResolutionTestPlugin</implementation>
         <instantiationStrategy>singleton</instantiationStrategy>
       </mojo>
       <mojo>
  -      <id>t1:postGoal</id>
  +      <id>resolveTest:t1-postGoal</id>
         <implementation>org.apache.maven.plugin.GoalDecorationAndResolutionTestPlugin</implementation>
         <instantiationStrategy>singleton</instantiationStrategy>
       </mojo>
  @@ -21,41 +21,41 @@
       
       <!-- Test main with prereq -->
       <mojo>
  -      <id>t2:prereq</id>
  +      <id>resolveTest:t2-prereq</id>
         <implementation>org.apache.maven.plugin.GoalDecorationAndResolutionTestPlugin</implementation>
         <instantiationStrategy>singleton</instantiationStrategy>
       </mojo>
       <mojo>
  -      <id>t2:main</id>
  +      <id>resolveTest:t2-main</id>
         <implementation>org.apache.maven.plugin.GoalDecorationAndResolutionTestPlugin</implementation>
         <instantiationStrategy>singleton</instantiationStrategy>
         <prereqs>
  -        <prereq>t2:prereq</prereq>
  +        <prereq>resolveTest:t2-prereq</prereq>
         </prereqs>
       </mojo>
       <!-- End of test -->
       
       <!-- Test main with prereq, preGoal and postGoal -->
       <mojo>
  -      <id>t3:preGoal</id>
  +      <id>resolveTest:t3-preGoal</id>
         <implementation>org.apache.maven.plugin.GoalDecorationAndResolutionTestPlugin</implementation>
         <instantiationStrategy>singleton</instantiationStrategy>
       </mojo>
       <mojo>
  -      <id>t3:prereq</id>
  +      <id>resolveTest:t3-prereq</id>
         <implementation>org.apache.maven.plugin.GoalDecorationAndResolutionTestPlugin</implementation>
         <instantiationStrategy>singleton</instantiationStrategy>
       </mojo>
       <mojo>
  -      <id>t3:main</id>
  +      <id>resolveTest:t3-main</id>
         <implementation>org.apache.maven.plugin.GoalDecorationAndResolutionTestPlugin</implementation>
         <instantiationStrategy>singleton</instantiationStrategy>
         <prereqs>
  -        <prereq>t3:prereq</prereq>
  +        <prereq>resolveTest:t3-prereq</prereq>
         </prereqs>
       </mojo>
       <mojo>
  -      <id>t3:postGoal</id>
  +      <id>resolveTest:t3-postGoal</id>
         <implementation>org.apache.maven.plugin.GoalDecorationAndResolutionTestPlugin</implementation>
         <instantiationStrategy>singleton</instantiationStrategy>
       </mojo>
  @@ -63,25 +63,25 @@
       
       <!-- Test main with prereq which has preGoal and postGoal -->
       <mojo>
  -      <id>t4:prereq-preGoal</id>
  +      <id>resolveTest:t4-prereq-preGoal</id>
         <implementation>org.apache.maven.plugin.GoalDecorationAndResolutionTestPlugin</implementation>
         <instantiationStrategy>singleton</instantiationStrategy>
       </mojo>
       <mojo>
  -      <id>t4:prereq</id>
  +      <id>resolveTest:t4-prereq</id>
         <implementation>org.apache.maven.plugin.GoalDecorationAndResolutionTestPlugin</implementation>
         <instantiationStrategy>singleton</instantiationStrategy>
       </mojo>
       <mojo>
  -      <id>t4:main</id>
  +      <id>resolveTest:t4-main</id>
         <implementation>org.apache.maven.plugin.GoalDecorationAndResolutionTestPlugin</implementation>
         <instantiationStrategy>singleton</instantiationStrategy>
         <prereqs>
  -        <prereq>t4:prereq</prereq>
  +        <prereq>resolveTest:t4-prereq</prereq>
         </prereqs>
       </mojo>
       <mojo>
  -      <id>t4:prereq-postGoal</id>
  +      <id>resolveTest:t4-prereq-postGoal</id>
         <implementation>org.apache.maven.plugin.GoalDecorationAndResolutionTestPlugin</implementation>
         <instantiationStrategy>singleton</instantiationStrategy>
       </mojo>
  @@ -90,24 +90,24 @@
   
       <!-- Test main with prereq and preGoal which has the same prereq -->
       <mojo>
  -      <id>t5:prereq</id>
  +      <id>resolveTest:t5-prereq</id>
         <implementation>org.apache.maven.plugin.GoalDecorationAndResolutionTestPlugin</implementation>
         <instantiationStrategy>singleton</instantiationStrategy>
       </mojo>
       <mojo>
  -      <id>t5:preGoal</id>
  +      <id>resolveTest:t5-preGoal</id>
         <implementation>org.apache.maven.plugin.GoalDecorationAndResolutionTestPlugin</implementation>
         <instantiationStrategy>singleton</instantiationStrategy>
         <prereqs>
  -        <prereq>t5:prereq</prereq>
  +        <prereq>resolveTest:t5-prereq</prereq>
         </prereqs>
       </mojo>
       <mojo>
  -      <id>t5:main</id>
  +      <id>resolveTest:t5-main</id>
         <implementation>org.apache.maven.plugin.GoalDecorationAndResolutionTestPlugin</implementation>
         <instantiationStrategy>singleton</instantiationStrategy>
         <prereqs>
  -        <prereq>t5:prereq</prereq>
  +        <prereq>resolveTest:t5-prereq</prereq>
         </prereqs>
       </mojo>
       <!-- End of test -->
  
  
  
  1.7       +41 -72    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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DefaultMaven.java	26 Aug 2004 01:18:08 -0000	1.6
  +++ DefaultMaven.java	26 Aug 2004 04:39:59 -0000	1.7
  @@ -1,19 +1,14 @@
   package org.apache.maven;
   
   /*
  - * 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.
  + * 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;
  @@ -23,6 +18,7 @@
   import org.apache.maven.lifecycle.goal.MavenGoalPhaseManager;
   import org.apache.maven.lifecycle.goal.GoalNotFoundException;
   import org.apache.maven.lifecycle.session.MavenSession;
  +import org.apache.maven.lifecycle.session.MavenSessionPhaseManager;
   import org.apache.maven.plugin.PluginManager;
   import org.apache.maven.plugin.descriptor.MojoDescriptor;
   import org.apache.maven.project.MavenProject;
  @@ -65,7 +61,7 @@
   
       private PluginManager pluginManager;
   
  -    private MavenGoalPhaseManager lifecycleManager;
  +    private MavenSessionPhaseManager lifecycleManager;
   
       private MavenProjectBuilder projectBuilder;
   
  @@ -75,20 +71,18 @@
       // Project execution
       // ----------------------------------------------------------------------
   
  -    public ExecutionResponse execute( List goals )
  -        throws GoalNotFoundException
  +    public ExecutionResponse execute( List goals ) throws GoalNotFoundException
       {
           return execute( (MavenProject) null, goals );
       }
   
  -    public ExecutionResponse execute( File projectFile, List goals )
  -        throws ProjectBuildingException, GoalNotFoundException
  +    public ExecutionResponse execute( File projectFile, List goals ) throws ProjectBuildingException,
  +        GoalNotFoundException
       {
           return execute( getProject( projectFile ), goals );
       }
   
  -    public ExecutionResponse execute( MavenProject project, List goals )
  -        throws GoalNotFoundException
  +    public ExecutionResponse execute( MavenProject project, List goals ) throws GoalNotFoundException
       {
           Date fullStop;
   
  @@ -96,57 +90,35 @@
   
           ExecutionResponse response = new ExecutionResponse();
   
  -        MavenSession session = new MavenSession( container,
  -                                                 pluginManager,
  -                                                 project,
  -                                                 getLocalRepository(),
  -                                                 goals );
  +        MavenSession session = new MavenSession( container, pluginManager, project, getLocalRepository(), goals );
   
  -        for ( Iterator iterator = goals.iterator(); iterator.hasNext(); )
  +        try
           {
  -            String goal = (String) iterator.next();
  -
  -            MavenGoalExecutionContext context;
  -
  -            try
  -            {
  -                context = new MavenGoalExecutionContext( session, getMojoDescriptor( goal ) );
  -
  -                context.setGoalName( goal );
  -
  -                lifecycleManager.execute( context );
  -
  -                if ( context.isExecutionFailure() )
  -                {
  -                    response.setExecutionFailure( context.getMojoDescriptor().getId(), context.getFailureResponse() );
  +            lifecycleManager.execute( session );
  +        }
  +        catch ( Exception e )
  +        {
  +            response.setException( e );
   
  -                    break;
  -                }
  -            }
  -            catch ( Exception e )
  +            if ( logResults )
               {
  -                response.setException( e );
  -
  -                if ( logResults )
  -                {
  -                    line();
  -
  -                    getLogger().error( "BUILD ERROR" );
  +                line();
   
  -                    line();
  +                getLogger().error( "BUILD ERROR" );
   
  -                    getLogger().error( "Cause: ", e );
  +                line();
   
  -                    line();
  +                getLogger().error( "Cause: ", e );
   
  -                    stats( fullStart, new Date() );
  +                line();
   
  -                    line();
  -                }
  +                stats( fullStart, new Date() );
   
  -                // An exception is a failure
  -                return response;
  +                line();
               }
  +
  +            // An exception is a failure
  +            return response;
           }
   
           fullStop = new Date();
  @@ -204,7 +176,8 @@
   
           Runtime r = Runtime.getRuntime();
   
  -        getLogger().info( "Final Memory: " + ( ( r.totalMemory() - r.freeMemory() ) / mb ) + "M/" + ( r.totalMemory() / mb ) + "M" );
  +        getLogger().info(
  +            "Final Memory: " + ((r.totalMemory() - r.freeMemory()) / mb) + "M/" + (r.totalMemory() / mb) + "M" );
   
       }
   
  @@ -217,8 +190,8 @@
       // Reactor execution
       // ----------------------------------------------------------------------
   
  -    public ExecutionResponse executeReactor( String goals, String includes, String excludes )
  -        throws ReactorException, GoalNotFoundException
  +    public ExecutionResponse executeReactor( String goals, String includes, String excludes ) throws ReactorException,
  +        GoalNotFoundException
       {
           List projects = new ArrayList();
   
  @@ -298,8 +271,7 @@
       // Project building
       // ----------------------------------------------------------------------
   
  -    public MavenProject getProject( File project )
  -        throws ProjectBuildingException
  +    public MavenProject getProject( File project ) throws ProjectBuildingException
       {
           if ( project.exists() )
           {
  @@ -316,8 +288,7 @@
       // Reactor
       // ----------------------------------------------------------------------
   
  -    public List getSortedProjects( List projects )
  -        throws Exception
  +    public List getSortedProjects( List projects ) throws Exception
       {
           return projectBuilder.getSortedProjects( projects );
       }
  @@ -361,8 +332,7 @@
       // Lifecylce Management
       // ----------------------------------------------------------------------
   
  -    public void contextualize( Context context )
  -        throws ContextException
  +    public void contextualize( Context context ) throws ContextException
       {
           container = (ArtifactEnabledContainer) context.get( PlexusConstants.PLEXUS_KEY );
       }
  @@ -393,9 +363,8 @@
       //
       // ----------------------------------------------------------------------
   
  -    public void booty()
  -        throws Exception
  +    public void booty() throws Exception
       {
           pluginManager.setLocalRepository( getLocalRepository() );
       }
  -}
  +}
  \ No newline at end of file
  
  
  
  1.2       +159 -167  maven-components/maven-core/src/test/java/org/apache/maven/lifecycle/goal/phase/GoalResolutionPhaseTest.java
  
  Index: GoalResolutionPhaseTest.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/test/java/org/apache/maven/lifecycle/goal/phase/GoalResolutionPhaseTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- GoalResolutionPhaseTest.java	15 Aug 2004 15:01:51 -0000	1.1
  +++ GoalResolutionPhaseTest.java	26 Aug 2004 04:40:00 -0000	1.2
  @@ -1,13 +1,19 @@
   /* Created on Jul 14, 2004 */
   package org.apache.maven.lifecycle.goal.phase;
   
  -import org.apache.maven.decoration.DefaultGoalDecorator;
  -import org.apache.maven.decoration.GoalDecoratorBindings;
  +import org.apache.maven.artifact.repository.ArtifactRepository;
   import org.apache.maven.lifecycle.goal.MavenGoalExecutionContext;
  +import org.apache.maven.model.Model;
  +import org.apache.maven.model.PostGoal;
  +import org.apache.maven.model.PreGoal;
  +import org.apache.maven.project.MavenProject;
   import org.apache.maven.MavenTestCase;
   
  +import java.io.File;
   import java.util.ArrayList;
  +import java.util.Collections;
   import java.util.Iterator;
  +import java.util.LinkedList;
   import java.util.List;
   import java.util.Map;
   import java.util.TreeMap;
  @@ -19,35 +25,37 @@
       extends MavenTestCase
   {
       /*
  -    <!-- Test main with preGoal and postGoal -->
  -    <mojo>
  -      <id>t1:preGoal</id>
  -      <implementation>org.apache.maven.plugin.GoalDecorationAndResolutionTestPlugin</implementation>
  -      <instantiationStrategy>singleton</instantiationStrategy>
  -    </mojo>
  -    <mojo>
  -      <id>t1:main</id>
  -      <implementation>org.apache.maven.plugin.GoalDecorationAndResolutionTestPlugin</implementation>
  -      <instantiationStrategy>singleton</instantiationStrategy>
  -    </mojo>
  -    <mojo>
  -      <id>t1:postGoal</id>
  -      <implementation>org.apache.maven.plugin.GoalDecorationAndResolutionTestPlugin</implementation>
  -      <instantiationStrategy>singleton</instantiationStrategy>
  -    </mojo>
  -    <!-- End of test -->
  -    */
  -    public void testT1_ShouldFind_PreGoal_MainGoal_PostGoal()
  -        throws Exception
  +     * <!-- Test main with preGoal and postGoal --> <mojo>
  +     * <id>resolveTest:t1-preGoal </id>
  +     * <implementation>org.apache.maven.plugin.GoalDecorationAndResolutionTestPlugin
  +     * </implementation> <instantiationStrategy>singleton
  +     * </instantiationStrategy> </mojo> <mojo> <id>resolveTest:t1-main </id>
  +     * <implementation>org.apache.maven.plugin.GoalDecorationAndResolutionTestPlugin
  +     * </implementation> <instantiationStrategy>singleton
  +     * </instantiationStrategy> </mojo> <mojo> <id>resolveTest:t1-postGoal </id>
  +     * <implementation>org.apache.maven.plugin.GoalDecorationAndResolutionTestPlugin
  +     * </implementation> <instantiationStrategy>singleton
  +     * </instantiationStrategy> </mojo> <!-- End of test -->
  +     */
  +    public void testT1_ShouldFind_PreGoal_MainGoal_PostGoal() throws Exception
       {
  -        String mainGoal = "t1:main";
  -        String preGoal = "t1:preGoal";
  -        String postGoal = "t1:postGoal";
  -
  -        GoalDecoratorBindings bindings = new GoalDecoratorBindings();
  +        String mainGoal = "resolveTest:t1-main";
  +        String preGoal = "resolveTest:t1-preGoal";
  +        String postGoal = "resolveTest:t1-postGoal";
  +
  +        PreGoal pg = new PreGoal();
  +        pg.setAttain( preGoal );
  +        pg.setName( mainGoal );
  +
  +        List preGoals = new LinkedList();
  +        preGoals.add( pg );
  +
  +        PostGoal pog = new PostGoal();
  +        pog.setAttain( postGoal );
  +        pog.setName( mainGoal );
   
  -        bindings.addPreGoal( new DefaultGoalDecorator( mainGoal, preGoal ) );
  -        bindings.addPostGoal( new DefaultGoalDecorator( mainGoal, postGoal ) );
  +        List postGoals = new LinkedList();
  +        postGoals.add( pog );
   
           Map messages = new TreeMap();
   
  @@ -61,33 +69,23 @@
           order.add( mainGoal );
           order.add( postGoal );
   
  -        runTest( mainGoal, bindings, order, messages );
  +        runTest( mainGoal, preGoals, postGoals, order, messages );
       }
   
       /*
  -    <!-- Test main with prereq -->
  -    <mojo>
  -      <id>t2:prereq</id>
  -      <implementation>org.apache.maven.plugin.GoalDecorationAndResolutionTestPlugin</implementation>
  -      <instantiationStrategy>singleton</instantiationStrategy>
  -    </mojo>
  -    <mojo>
  -      <id>t2:main</id>
  -      <implementation>org.apache.maven.plugin.GoalDecorationAndResolutionTestPlugin</implementation>
  -      <instantiationStrategy>singleton</instantiationStrategy>
  -      <prereqs>
  -        <prereq>t2:prereq</prereq>
  -      </prereqs>
  -    </mojo>
  -    <!-- End of test -->
  -    */
  -    public void testT2_ShouldFind_Prereq_MainGoal()
  -        throws Exception
  +     * <!-- Test main with prereq --> <mojo> <id>resolveTest:t2-prereq </id>
  +     * <implementation>org.apache.maven.plugin.GoalDecorationAndResolutionTestPlugin
  +     * </implementation> <instantiationStrategy>singleton
  +     * </instantiationStrategy> </mojo> <mojo> <id>resolveTest:t2-main </id>
  +     * <implementation>org.apache.maven.plugin.GoalDecorationAndResolutionTestPlugin
  +     * </implementation> <instantiationStrategy>singleton
  +     * </instantiationStrategy> <prereqs> <prereq>resolveTest:t2-prereq
  +     * </prereq> </prereqs> </mojo> <!-- End of test -->
  +     */
  +    public void testT2_ShouldFind_Prereq_MainGoal() throws Exception
       {
  -        String mainGoal = "t2:main";
  -        String prereq = "t2:prereq";
  -
  -        GoalDecoratorBindings bindings = new GoalDecoratorBindings();
  +        String mainGoal = "resolveTest:t2-main";
  +        String prereq = "resolveTest:t2-prereq";
   
           Map messages = new TreeMap();
   
  @@ -99,48 +97,46 @@
           order.add( prereq );
           order.add( mainGoal );
   
  -        runTest( mainGoal, bindings, order, messages );
  +        runTest( mainGoal, Collections.EMPTY_LIST, Collections.EMPTY_LIST, order, messages );
       }
   
       /*
  -    <!-- Test main with prereq, preGoal and postGoal -->
  -    <mojo>
  -      <id>t3:preGoal</id>
  -      <implementation>org.apache.maven.plugin.GoalDecorationAndResolutionTestPlugin</implementation>
  -      <instantiationStrategy>singleton</instantiationStrategy>
  -    </mojo>
  -    <mojo>
  -      <id>t3:prereq</id>
  -      <implementation>org.apache.maven.plugin.GoalDecorationAndResolutionTestPlugin</implementation>
  -      <instantiationStrategy>singleton</instantiationStrategy>
  -    </mojo>
  -    <mojo>
  -      <id>t3:main</id>
  -      <implementation>org.apache.maven.plugin.GoalDecorationAndResolutionTestPlugin</implementation>
  -      <instantiationStrategy>singleton</instantiationStrategy>
  -      <prereqs>
  -        <prereq>t3:prereq</prereq>
  -      </prereqs>
  -    </mojo>
  -    <mojo>
  -      <id>t3:postGoal</id>
  -      <implementation>org.apache.maven.plugin.GoalDecorationAndResolutionTestPlugin</implementation>
  -      <instantiationStrategy>singleton</instantiationStrategy>
  -    </mojo>
  -    <!-- End of test -->
  -    */
  -    public void testT3_ShouldFind_PreGoal_Prereq_MainGoal_PostGoal()
  -        throws Exception
  +     * <!-- Test main with prereq, preGoal and postGoal --> <mojo>
  +     * <id>resolveTest:t3-preGoal </id>
  +     * <implementation>org.apache.maven.plugin.GoalDecorationAndResolutionTestPlugin
  +     * </implementation> <instantiationStrategy>singleton
  +     * </instantiationStrategy> </mojo> <mojo> <id>resolveTest:t3-prereq </id>
  +     * <implementation>org.apache.maven.plugin.GoalDecorationAndResolutionTestPlugin
  +     * </implementation> <instantiationStrategy>singleton
  +     * </instantiationStrategy> </mojo> <mojo> <id>resolveTest:t3-main </id>
  +     * <implementation>org.apache.maven.plugin.GoalDecorationAndResolutionTestPlugin
  +     * </implementation> <instantiationStrategy>singleton
  +     * </instantiationStrategy> <prereqs> <prereq>resolveTest:t3-prereq
  +     * </prereq> </prereqs> </mojo> <mojo> <id>resolveTest:t3-postGoal </id>
  +     * <implementation>org.apache.maven.plugin.GoalDecorationAndResolutionTestPlugin
  +     * </implementation> <instantiationStrategy>singleton
  +     * </instantiationStrategy> </mojo> <!-- End of test -->
  +     */
  +    public void testT3_ShouldFind_PreGoal_Prereq_MainGoal_PostGoal() throws Exception
       {
  -        String mainGoal = "t3:main";
  -        String prereq = "t3:prereq";
  -        String preGoal = "t3:preGoal";
  -        String postGoal = "t3:postGoal";
  -
  -        GoalDecoratorBindings bindings = new GoalDecoratorBindings();
  +        String mainGoal = "resolveTest:t3-main";
  +        String prereq = "resolveTest:t3-prereq";
  +        String preGoal = "resolveTest:t3-preGoal";
  +        String postGoal = "resolveTest:t3-postGoal";
  +
  +        PreGoal pg = new PreGoal();
  +        pg.setAttain( preGoal );
  +        pg.setName( mainGoal );
  +
  +        List preGoals = new LinkedList();
  +        preGoals.add( pg );
  +
  +        PostGoal pog = new PostGoal();
  +        pog.setAttain( postGoal );
  +        pog.setName( mainGoal );
   
  -        bindings.addPreGoal( new DefaultGoalDecorator( mainGoal, preGoal ) );
  -        bindings.addPostGoal( new DefaultGoalDecorator( mainGoal, postGoal ) );
  +        List postGoals = new LinkedList();
  +        postGoals.add( pog );
   
           Map messages = new TreeMap();
   
  @@ -156,48 +152,47 @@
           order.add( mainGoal );
           order.add( postGoal );
   
  -        runTest( mainGoal, bindings, order, messages );
  +        runTest( mainGoal, preGoals, postGoals, order, messages );
       }
   
       /*
  -    <!-- Test main with prereq which has preGoal and postGoal -->
  -    <mojo>
  -      <id>t4:prereq-preGoal</id>
  -      <implementation>org.apache.maven.plugin.GoalDecorationAndResolutionTestPlugin</implementation>
  -      <instantiationStrategy>singleton</instantiationStrategy>
  -    </mojo>
  -    <mojo>
  -      <id>t4:prereq</id>
  -      <implementation>org.apache.maven.plugin.GoalDecorationAndResolutionTestPlugin</implementation>
  -      <instantiationStrategy>singleton</instantiationStrategy>
  -    </mojo>
  -    <mojo>
  -      <id>t4:main</id>
  -      <implementation>org.apache.maven.plugin.GoalDecorationAndResolutionTestPlugin</implementation>
  -      <instantiationStrategy>singleton</instantiationStrategy>
  -      <prereqs>
  -        <prereq>t4:prereq</prereq>
  -      </prereqs>
  -    </mojo>
  -    <mojo>
  -      <id>t4:prereq-postGoal</id>
  -      <implementation>org.apache.maven.plugin.GoalDecorationAndResolutionTestPlugin</implementation>
  -      <instantiationStrategy>singleton</instantiationStrategy>
  -    </mojo>
  -    <!-- End of test -->
  -    */
  -    public void testT4_ShouldFind_PreGoal_Prereq_PostGoal_MainGoal()
  -        throws Exception
  +     * <!-- Test main with prereq which has preGoal and postGoal --> <mojo>
  +     * <id>resolveTest:t4-prereq-preGoal </id>
  +     * <implementation>org.apache.maven.plugin.GoalDecorationAndResolutionTestPlugin
  +     * </implementation> <instantiationStrategy>singleton
  +     * </instantiationStrategy> </mojo> <mojo> <id>resolveTest:t4-prereq </id>
  +     * <implementation>org.apache.maven.plugin.GoalDecorationAndResolutionTestPlugin
  +     * </implementation> <instantiationStrategy>singleton
  +     * </instantiationStrategy> </mojo> <mojo> <id>resolveTest:t4-main </id>
  +     * <implementation>org.apache.maven.plugin.GoalDecorationAndResolutionTestPlugin
  +     * </implementation> <instantiationStrategy>singleton
  +     * </instantiationStrategy> <prereqs> <prereq>resolveTest:t4-prereq
  +     * </prereq> </prereqs> </mojo> <mojo> <id>resolveTest:t4-prereq-postGoal
  +     * </id>
  +     * <implementation>org.apache.maven.plugin.GoalDecorationAndResolutionTestPlugin
  +     * </implementation> <instantiationStrategy>singleton
  +     * </instantiationStrategy> </mojo> <!-- End of test -->
  +     */
  +    public void testT4_ShouldFind_PreGoal_Prereq_PostGoal_MainGoal() throws Exception
       {
  -        String mainGoal = "t4:main";
  -        String prereq = "t4:prereq";
  -        String preGoal = "t4:prereq-preGoal";
  -        String postGoal = "t4:prereq-postGoal";
  +        String mainGoal = "resolveTest:t4-main";
  +        String prereq = "resolveTest:t4-prereq";
  +        String preGoal = "resolveTest:t4-prereq-preGoal";
  +        String postGoal = "resolveTest:t4-prereq-postGoal";
  +
  +        PreGoal pg = new PreGoal();
  +        pg.setAttain( preGoal );
  +        pg.setName( prereq );
  +
  +        List preGoals = new LinkedList();
  +        preGoals.add( pg );
  +
  +        PostGoal pog = new PostGoal();
  +        pog.setAttain( postGoal );
  +        pog.setName( prereq );
   
  -        GoalDecoratorBindings bindings = new GoalDecoratorBindings();
  -
  -        bindings.addPreGoal( new DefaultGoalDecorator( prereq, preGoal ) );
  -        bindings.addPostGoal( new DefaultGoalDecorator( prereq, postGoal ) );
  +        List postGoals = new LinkedList();
  +        postGoals.add( pog );
   
           Map messages = new TreeMap();
   
  @@ -213,44 +208,36 @@
           order.add( postGoal );
           order.add( mainGoal );
   
  -        runTest( mainGoal, bindings, order, messages );
  +        runTest( mainGoal, preGoals, postGoals, order, messages );
       }
   
       /*
  -    <!-- Test main with prereq and preGoal which has the same prereq -->
  -    <mojo>
  -      <id>t5:prereq</id>
  -      <implementation>org.apache.maven.plugin.GoalDecorationAndResolutionTestPlugin</implementation>
  -      <instantiationStrategy>singleton</instantiationStrategy>
  -    </mojo>
  -    <mojo>
  -      <id>t5:preGoal</id>
  -      <implementation>org.apache.maven.plugin.GoalDecorationAndResolutionTestPlugin</implementation>
  -      <instantiationStrategy>singleton</instantiationStrategy>
  -      <prereqs>
  -        <prereq>t5:prereq</prereq>
  -      </prereqs>
  -    </mojo>
  -    <mojo>
  -      <id>t5:main</id>
  -      <implementation>org.apache.maven.plugin.GoalDecorationAndResolutionTestPlugin</implementation>
  -      <instantiationStrategy>singleton</instantiationStrategy>
  -      <prereqs>
  -        <prereq>t5:prereq</prereq>
  -      </prereqs>
  -    </mojo>
  -    <!-- End of test -->
  -    */
  -    public void testT5_ShouldFind_Prereq_PreGoal_MainGoal()
  -        throws Exception
  +     * <!-- Test main with prereq and preGoal which has the same prereq -->
  +     * <mojo> <id>resolveTest:t5-prereq </id>
  +     * <implementation>org.apache.maven.plugin.GoalDecorationAndResolutionTestPlugin
  +     * </implementation> <instantiationStrategy>singleton
  +     * </instantiationStrategy> </mojo> <mojo> <id>resolveTest:t5-preGoal </id>
  +     * <implementation>org.apache.maven.plugin.GoalDecorationAndResolutionTestPlugin
  +     * </implementation> <instantiationStrategy>singleton
  +     * </instantiationStrategy> <prereqs> <prereq>resolveTest:t5-prereq
  +     * </prereq> </prereqs> </mojo> <mojo> <id>resolveTest:t5-main </id>
  +     * <implementation>org.apache.maven.plugin.GoalDecorationAndResolutionTestPlugin
  +     * </implementation> <instantiationStrategy>singleton
  +     * </instantiationStrategy> <prereqs> <prereq>resolveTest:t5-prereq
  +     * </prereq> </prereqs> </mojo> <!-- End of test -->
  +     */
  +    public void testT5_ShouldFind_Prereq_PreGoal_MainGoal() throws Exception
       {
  -        String mainGoal = "t5:main";
  -        String prereq = "t5:prereq";
  -        String preGoal = "t5:preGoal";
  -
  -        GoalDecoratorBindings bindings = new GoalDecoratorBindings();
  +        String mainGoal = "resolveTest:t5-main";
  +        String prereq = "resolveTest:t5-prereq";
  +        String preGoal = "resolveTest:t5-preGoal";
  +
  +        PreGoal pg = new PreGoal();
  +        pg.setAttain( preGoal );
  +        pg.setName( mainGoal );
   
  -        bindings.addPreGoal( new DefaultGoalDecorator( mainGoal, preGoal ) );
  +        List preGoals = new LinkedList();
  +        preGoals.add( pg );
   
           Map messages = new TreeMap();
   
  @@ -264,16 +251,23 @@
           order.add( preGoal );
           order.add( mainGoal );
   
  -        runTest( mainGoal, bindings, order, messages );
  +        runTest( mainGoal, preGoals, Collections.EMPTY_LIST, order, messages );
       }
   
  -    private void runTest( String mainGoal, GoalDecoratorBindings bindings,
  -                          List expectedOrder, Map messages )
  +    private void runTest( String mainGoal, List preGoals, List postGoals, List expectedOrder, Map messages )
           throws Exception
       {
  -        MavenGoalExecutionContext context = createGoalExecutionContext( mainGoal );
  +        ArtifactRepository localRepository = new ArtifactRepository( "local", getTestRepoURL() );
   
  -        context.setGoalDecoratorBindings( bindings );
  +        Model model = new Model();
  +        model.setPreGoals( preGoals );
  +        model.setPostGoals( postGoals );
  +
  +        MavenProject project = new MavenProject( model );
  +        project.setProperties( new TreeMap() );
  +
  +        MavenGoalExecutionContext context = createGoalExecutionContext( project, localRepository, mainGoal );
  +        context.setGoalName( mainGoal );
   
           GoalResolutionPhase phase = new GoalResolutionPhase();
   
  @@ -281,8 +275,6 @@
   
           List goals = context.getResolvedGoals();
   
  -        System.out.println( "Resolved goals: " + goals );
  -
           assertNotNull( goals );
   
           assertEquals( expectedOrder.size(), goals.size() );
  @@ -300,4 +292,4 @@
               assertEquals( failureMessage, goal, resolvedGoal );
           }
       }
  -}
  +}
  \ No newline at end of file
  
  
  
  1.2       +10 -17    maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/handler/manager/DefaultArtifactHandlerManager.java
  
  Index: DefaultArtifactHandlerManager.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/handler/manager/DefaultArtifactHandlerManager.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultArtifactHandlerManager.java	9 Aug 2004 18:37:32 -0000	1.1
  +++ DefaultArtifactHandlerManager.java	26 Aug 2004 04:40:01 -0000	1.2
  @@ -25,23 +25,22 @@
    */
   
   /**
  - * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
  - * @version $Id$
  + * @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
  + * @version $Id: DefaultArtifactHandlerManager.java,v 1.1.1.1 2004/08/09
  + *          18:37:32 jvanzyl Exp $
    */
   public class DefaultArtifactHandlerManager
       implements ArtifactHandlerManager
   {
       private Map artifactHandlers;
   
  -    public ArtifactHandler getArtifactHandler( String type )
  -        throws ArtifactHandlerNotFoundException
  +    public ArtifactHandler getArtifactHandler( String type ) throws ArtifactHandlerNotFoundException
       {
           ArtifactHandler handler = (ArtifactHandler) artifactHandlers.get( type );
   
           if ( handler == null )
           {
  -            throw new ArtifactHandlerNotFoundException(
  -                "Artifact handler for type '" + type + "' cannot be found." );
  +            throw new ArtifactHandlerNotFoundException( "Artifact handler for type '" + type + "' cannot be found." );
           }
   
           return handler;
  @@ -82,18 +81,12 @@
       {
           ArtifactHandler handler = (ArtifactHandler) artifactHandlers.get( artifact.getType() );
   
  -        return interpolateLayout( artifact.getGroupId(),
  -                                  artifact.getArtifactId(),
  -                                  artifact.getVersion(),
  -                                  handler.directory(),
  -                                  handler.extension() );
  +        return interpolateLayout( artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), handler
  +            .directory(), handler.extension() );
       }
   
  -    private String interpolateLayout( String groupId,
  -                                      String artifactId,
  -                                      String version,
  -                                      String directory,
  -                                      String extension )
  +    private String interpolateLayout( String groupId, String artifactId, String version, String directory,
  +        String extension )
       {
           String layout = getLayout();
   
  @@ -109,4 +102,4 @@
   
           return layout;
       }
  -}
  +}
  \ No newline at end of file
  
  
  
  1.2       +9 -21     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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MavenGoalExecutionContext.java	15 Aug 2004 15:01:50 -0000	1.1
  +++ MavenGoalExecutionContext.java	26 Aug 2004 04:40:02 -0000	1.2
  @@ -1,7 +1,6 @@
   package org.apache.maven.lifecycle.goal;
   
   import org.apache.maven.artifact.repository.ArtifactRepository;
  -import org.apache.maven.decoration.GoalDecoratorBindings;
   import org.apache.maven.lifecycle.session.MavenSession;
   import org.apache.maven.plugin.FailureResponse;
   import org.apache.maven.plugin.descriptor.MojoDescriptor;
  @@ -12,8 +11,9 @@
   import java.util.Set;
   
   /**
  - * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
  - * @version $Id$
  + * @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
  + * @version $Id: MavenGoalExecutionContext.java,v 1.1 2004/08/15 15:01:50
  + *          jvanzyl Exp $
    */
   public class MavenGoalExecutionContext
   {
  @@ -27,13 +27,13 @@
   
       private List resolvedGoals;
   
  -    private GoalDecoratorBindings goalDecoratorBindings;
  +    //    private GoalDecoratorBindings goalDecoratorBindings;
   
       private String goalName;
   
       public MavenGoalExecutionContext( MavenSession session, MojoDescriptor goal )
       {
  -        this.session  = session;
  +        this.session = session;
   
           this.mojoDescriptor = goal;
       }
  @@ -62,14 +62,12 @@
           return session.getRemoteRepositories();
       }
   
  -    public Object lookup( String role )
  -        throws ComponentLookupException
  +    public Object lookup( String role ) throws ComponentLookupException
       {
           return session.lookup( role );
       }
   
  -    public Object lookup( String role, String hint )
  -        throws ComponentLookupException
  +    public Object lookup( String role, String hint ) throws ComponentLookupException
       {
           return session.lookup( role, hint );
       }
  @@ -125,7 +123,7 @@
   
       public boolean isExecutionFailure()
       {
  -        return ( failedGoal != null );
  +        return (failedGoal != null);
       }
   
       public String getFailedGoal()
  @@ -148,16 +146,6 @@
           this.failureResponse = failureResponse;
       }
   
  -    public GoalDecoratorBindings getGoalDecoratorBindings()
  -    {
  -        return goalDecoratorBindings;
  -    }
  -
  -    public void setGoalDecoratorBindings( GoalDecoratorBindings goalDecoratorBindings )
  -    {
  -        this.goalDecoratorBindings = goalDecoratorBindings;
  -    }
  -
       public String getGoalName()
       {
           return goalName;
  @@ -167,4 +155,4 @@
       {
           this.goalName = goalName;
       }
  -}
  +}
  \ No newline at end of file
  
  
  

Mime
View raw message