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/resources/org/apache/maven plexus.xml
Date Thu, 17 Jun 2004 01:16:03 GMT
jvanzyl     2004/06/16 18:16:03

  Modified:    maven-core/src/main/java/org/apache/maven
                        DefaultMavenCore.java
               maven-core/src/main/java/org/apache/maven/lifecycle/phase
                        GoalAttainmentPhase.java
               maven-core/src/main/java/org/apache/maven/plugin
                        DefaultPluginManager.java PluginManager.java
               maven-core/src/main/resources/org/apache/maven plexus.xml
  Log:
  o fixing a problem with transitive dependencies. temporarily doing the check
    in the goal attainment phase so i can make some more tests before tackling
    the lifecycle again.
  
  Revision  Changes    Path
  1.4       +2 -2      maven-components/maven-core/src/main/java/org/apache/maven/DefaultMavenCore.java
  
  Index: DefaultMavenCore.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/DefaultMavenCore.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DefaultMavenCore.java	17 Jun 2004 00:07:23 -0000	1.3
  +++ DefaultMavenCore.java	17 Jun 2004 01:16:02 -0000	1.4
  @@ -162,12 +162,12 @@
   
       public Map getGoalDescriptors()
       {
  -        return pluginManager.getGoalDescriptors();
  +        return pluginManager.getGoals();
       }
   
       public Goal getGoalDescriptor( String goalId )
       {
  -        return pluginManager.getGoalDescriptor( goalId );
  +        return pluginManager.getGoal( goalId );
       }
   
       // ----------------------------------------------------------------------
  
  
  
  1.3       +34 -3     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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- GoalAttainmentPhase.java	17 Jun 2004 00:07:23 -0000	1.2
  +++ GoalAttainmentPhase.java	17 Jun 2004 01:16:02 -0000	1.3
  @@ -7,6 +7,10 @@
   import org.apache.maven.plugin.PluginExecutionResponse;
   import org.apache.maven.plugin.PluginManager;
   import org.apache.maven.plugin.descriptor.Goal;
  +import org.apache.maven.project.MavenProject;
  +import org.apache.maven.project.MavenProjectBuilder;
  +import org.apache.maven.artifact.collector.ArtifactCollector;
  +import org.apache.maven.artifact.collector.ArtifactCollectionResult;
   
   import java.util.Iterator;
   import java.util.List;
  @@ -25,20 +29,31 @@
   
           List goals = pluginManager.getGoals( context.getGoal().getName() );
   
  -        PluginExecutionResponse response = new PluginExecutionResponse();
  +        PluginExecutionResponse response;
   
           PluginExecutionRequest request;
   
  +        boolean transitiveDependenciesResolved = false;
  +
           for ( Iterator it = goals.iterator(); it.hasNext(); )
           {
               String goalName = (String) it.next();
   
  -            Goal goal = pluginManager.getGoalDescriptor( goalName );
  +            Goal goal = pluginManager.getGoal( goalName );
   
               System.out.println( "[" + goal.getName() + "]" );
   
  +            if ( goal.requiresDependencyResolution() && ! transitiveDependenciesResolved
)
  +            {
  +                resolveTransitiveDependencies( context );
  +                
  +                transitiveDependenciesResolved = true;
  +            }
  +
               request = new PluginExecutionRequest( pluginManager.createParameters( goal,
context.getProject() ) );
   
  +            response = new PluginExecutionResponse();
  +
               try
               {
                   Plugin plugin = (Plugin) context.lookup( Plugin.ROLE, pluginManager.getPluginDescriptor(
goal.getName() ).getId() );
  @@ -48,7 +63,23 @@
               catch ( Exception e )
               {
                   response.setException( e );
  +
  +                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() );
       }
   }
  
  
  
  1.6       +2 -2      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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DefaultPluginManager.java	17 Jun 2004 00:07:23 -0000	1.5
  +++ DefaultPluginManager.java	17 Jun 2004 01:16:03 -0000	1.6
  @@ -128,12 +128,12 @@
       // Goal descriptors
       // ----------------------------------------------------------------------
   
  -    public Map getGoalDescriptors()
  +    public Map getGoals()
       {
           return goalDescriptors;
       }
   
  -    public Goal getGoalDescriptor( String name )
  +    public Goal getGoal( String name )
       {
           return (Goal) goalDescriptors.get( name );
       }
  
  
  
  1.3       +2 -8      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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PluginManager.java	17 Jun 2004 00:07:23 -0000	1.2
  +++ PluginManager.java	17 Jun 2004 01:16:03 -0000	1.3
  @@ -35,12 +35,6 @@
       String ROLE = PluginManager.class.getName();
   
       // ----------------------------------------------------------------------
  -    // Plugin execution
  -    // ----------------------------------------------------------------------
  -
  -    //PluginExecutionResponse attainGoal( MavenLifecycleContext context );
  -
  -    // ----------------------------------------------------------------------
       // Plugin processing
       // ----------------------------------------------------------------------
   
  @@ -59,9 +53,9 @@
       //  Goal descriptors
       // ----------------------------------------------------------------------
   
  -    Map getGoalDescriptors();
  +    Map getGoals();
   
  -    Goal getGoalDescriptor( String goalId );
  +    Goal getGoal( String goalId );
   
       // ----------------------------------------------------------------------
       //
  
  
  
  1.7       +0 -1      maven-components/maven-core/src/main/resources/org/apache/maven/plexus.xml
  
  Index: plexus.xml
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/resources/org/apache/maven/plexus.xml,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- plexus.xml	15 Jun 2004 20:18:01 -0000	1.6
  +++ plexus.xml	17 Jun 2004 01:16:03 -0000	1.7
  @@ -52,7 +52,6 @@
           <lifecycle-phases>
             <lifecycle-phase implementation="org.apache.maven.lifecycle.phase.GoalDecorationPhase"/>
             <lifecycle-phase implementation="org.apache.maven.lifecycle.phase.GoalResolutionPhase"/>
  -          <lifecycle-phase implementation="org.apache.maven.lifecycle.phase.DependencyResolutionPhase"/>
             <lifecycle-phase implementation="org.apache.maven.lifecycle.phase.PluginDownloadPhase"/>
             <lifecycle-phase implementation="org.apache.maven.lifecycle.phase.ArtifactDownloadPhase"/>
             <lifecycle-phase implementation="org.apache.maven.lifecycle.phase.GoalAttainmentPhase"/>
  
  
  

Mime
View raw message