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/main/java/org/apache/maven/lifecycle/phase DependencyResolutionPhase.java GoalAttainmentPhase.java
Date Thu, 17 Jun 2004 15:16:58 GMT
jvanzyl     2004/06/17 08:16:57

  Modified:    maven-core/src/main/java/org/apache/maven/lifecycle/phase
                        DependencyResolutionPhase.java
                        GoalAttainmentPhase.java
  Log:
  o i have pulled out the dependency resolution code from the goal attainment
    phase and put it back in its own phase. so now we have three phases that
    are working in the lifecycle pipeline:
  
    goal resolution
    dependency resolution
    goal attainment
  
    now that this is done i think it's now possible to get some dependency
    downloading working as well as some plugin downloading.
  
  Revision  Changes    Path
  1.4       +24 -14    maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/phase/DependencyResolutionPhase.java
  
  Index: DependencyResolutionPhase.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/phase/DependencyResolutionPhase.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DependencyResolutionPhase.java	17 Jun 2004 00:07:23 -0000	1.3
  +++ DependencyResolutionPhase.java	17 Jun 2004 15:16:57 -0000	1.4
  @@ -1,12 +1,13 @@
   package org.apache.maven.lifecycle.phase;
   
  -import org.apache.maven.lifecycle.AbstractMavenLifecyclePhase;
  -import org.apache.maven.lifecycle.MavenLifecycleContext;
   import org.apache.maven.artifact.collector.ArtifactCollectionResult;
   import org.apache.maven.artifact.collector.ArtifactCollector;
  +import org.apache.maven.lifecycle.AbstractMavenLifecyclePhase;
  +import org.apache.maven.lifecycle.MavenLifecycleContext;
   import org.apache.maven.project.MavenProject;
   import org.apache.maven.project.MavenProjectBuilder;
  -import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
  +
  +import java.util.Iterator;
   
   /**
    * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
  @@ -18,21 +19,30 @@
       public void execute( MavenLifecycleContext context )
           throws Exception
       {
  -        System.out.println( "context.getGoal().getName() = " + context.getGoal().getName()
);
  +        for ( Iterator iterator = context.getResolvedGoals().iterator(); iterator.hasNext();
)
  +        {
  +            String goalName = (String) iterator.next();
   
  -        System.out.println( "context.requiresDependencyResolution() = " + context.requiresDependencyResolution()
);
  +            if ( context.getGoal( goalName ).requiresDependencyResolution() )
  +            {
  +                resolveTransitiveDependencies( context );
   
  -        if ( context.requiresDependencyResolution() )
  -        {
  -            MavenProject project = context.getProject();
  +                break;
  +            }
  +        }
  +    }
  +
  +    private void resolveTransitiveDependencies( MavenLifecycleContext context )
  +        throws Exception
  +    {
  +        MavenProject project = context.getProject();
   
  -            ArtifactCollector artifactCollector = (ArtifactCollector) context.lookup( ArtifactCollector.ROLE
);
  +        ArtifactCollector artifactCollector = (ArtifactCollector) context.lookup( ArtifactCollector.ROLE
);
   
  -            MavenProjectBuilder builder = (MavenProjectBuilder) context.lookup( MavenProjectBuilder.ROLE
);
  +        MavenProjectBuilder builder = (MavenProjectBuilder) context.lookup( MavenProjectBuilder.ROLE
);
   
  -            ArtifactCollectionResult result = artifactCollector.collect( project, builder
);
  +        ArtifactCollectionResult result = artifactCollector.collect( project, builder );
   
  -            project.getArtifacts().addAll( result.getArtifacts().values() );
  -        }
  +        project.getArtifacts().addAll( result.getArtifacts().values() );
       }
   }
  
  
  
  1.5       +0 -23     maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/phase/GoalAttainmentPhase.java
  
  Index: GoalAttainmentPhase.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/phase/GoalAttainmentPhase.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- GoalAttainmentPhase.java	17 Jun 2004 14:45:47 -0000	1.4
  +++ GoalAttainmentPhase.java	17 Jun 2004 15:16:57 -0000	1.5
  @@ -27,8 +27,6 @@
   
           PluginExecutionRequest request;
   
  -        boolean transitiveDependenciesResolved = false;
  -
           for ( Iterator it = context.getResolvedGoals().iterator(); it.hasNext(); )
           {
               String goalName = (String) it.next();
  @@ -37,13 +35,6 @@
   
               System.out.println( "[" + goal.getName() + "]" );
   
  -            if ( goal.requiresDependencyResolution() && ! transitiveDependenciesResolved
)
  -            {
  -                resolveTransitiveDependencies( context );
  -                
  -                transitiveDependenciesResolved = true;
  -            }
  -
               request = new PluginExecutionRequest( context.createParameters( goal ) );
   
               response = new PluginExecutionResponse();
  @@ -61,19 +52,5 @@
                   break;
               }
           }
  -    }
  -
  -    private void resolveTransitiveDependencies( MavenLifecycleContext context )
  -        throws Exception
  -    {
  -        MavenProject project = context.getProject();
  -
  -        ArtifactCollector artifactCollector = (ArtifactCollector) context.lookup( ArtifactCollector.ROLE
);
  -
  -        MavenProjectBuilder builder = (MavenProjectBuilder) context.lookup( MavenProjectBuilder.ROLE
);
  -
  -        ArtifactCollectionResult result = artifactCollector.collect( project, builder );
  -
  -        project.getArtifacts().addAll( result.getArtifacts().values() );
       }
   }
  
  
  

Mime
View raw message