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 DefaultMaven.java
Date Thu, 10 Mar 2005 23:01:38 GMT
jdcasey     2005/03/10 15:01:38

  Modified:    maven-core/src/main/java/org/apache/maven/project
                        DefaultMavenProjectBuilder.java
                        MavenProjectBuilder.java MavenProject.java
               maven-model pom.xml maven.mdo
               maven-core/src/main/resources/org/apache/maven/project
                        pom-4.0.0.xml
               maven-core/src/main/java/org/apache/maven/execution
                        MavenInitializingExecutionRequest.java
               maven-core/src/main/java/org/apache/maven/lifecycle
                        DefaultLifecycleExecutor.java
               maven-user-model pom.xml
               maven-core/src/main/java/org/apache/maven/project/inheritance
                        DefaultModelInheritanceAssembler.java
               maven-core/src/main/java/org/apache/maven/project/injection
                        DefaultModelDefaultsInjector.java
               maven-core/src/main/java/org/apache/maven DefaultMaven.java
  Log:
  o Moved the default plugin stuff to <pluginManagement/>. Plugin config will be pulled
from here and injected into <plugins/> as needed to satisfy type-handlers at runtime.
  o Added the ability for DefaultMaven to load only the super-pom in the event that no pom.xml
exists to initiate the assembly.
  
  Revision  Changes    Path
  1.41      +91 -55    maven-components/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
  
  Index: DefaultMavenProjectBuilder.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- DefaultMavenProjectBuilder.java	10 Mar 2005 01:35:14 -0000	1.40
  +++ DefaultMavenProjectBuilder.java	10 Mar 2005 23:01:35 -0000	1.41
  @@ -31,6 +31,7 @@
   import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
   import org.apache.maven.project.inheritance.ModelInheritanceAssembler;
   import org.apache.maven.project.injection.ModelDefaultsInjector;
  +import org.apache.maven.project.interpolation.ModelInterpolationException;
   import org.apache.maven.project.interpolation.ModelInterpolator;
   import org.apache.maven.project.path.PathTranslator;
   import org.apache.maven.project.validation.ModelValidationResult;
  @@ -118,67 +119,74 @@
                   previous = current;
               }
   
  -            Model model = modelInterpolator.interpolate( project.getModel() );
  +            project = processProjectLogic( project, localRepository, resolveDependencies
);
   
  -            // interpolation is before injection, because interpolation is off-limits in
the injected variables
  -            modelDefaultsInjector.injectDefaults( model );
  -
  -            MavenProject parentProject = project.getParent();
  -
  -            project = new MavenProject( model );
               project.setFile( projectDescriptor );
  -            project.setParent( parentProject );
  -            project.setArtifacts( artifactFactory.createArtifacts( project.getDependencies(),
localRepository, null ) );
  -
  -            // ----------------------------------------------------------------------
  -            // Typically when the project builder is being used from maven proper
  -            // the transitive dependencies will not be resolved here because this
  -            // requires a lot of work when we may only be interested in running
  -            // something simple like 'm2 clean'. So the artifact collector is used
  -            // in the dependency resolution phase if it is required by any of the
  -            // goals being executed. But when used as a component in another piece
  -            // of code people may just want to build maven projects and have the
  -            // dependencies resolved for whatever reason: this is why we keep
  -            // this snippet of code here.
  -            // ----------------------------------------------------------------------
  +            pathTranslator.alignToBaseDirectory( project.getModel(), projectDescriptor
);
   
  -            if ( resolveDependencies )
  -            {
  -                List repos = buildArtifactRepositories( project.getRepositories() );
  +            return project;
  +        }
  +        catch ( Exception e )
  +        {
  +            throw new ProjectBuildingException( "Error building project from " + projectDescriptor,
e );
  +        }
  +    }
   
  -                MavenMetadataSource sourceReader = new MavenMetadataSource( artifactResolver,
this );
  +    private MavenProject processProjectLogic( MavenProject project, ArtifactRepository
localRepository,
  +                                             boolean resolveDependencies )
  +        throws ProjectBuildingException, ModelInterpolationException, ArtifactResolutionException
  +    {
  +        Model model = modelInterpolator.interpolate( project.getModel() );
   
  -                ArtifactResolutionResult result = artifactResolver.resolveTransitively(
project.getArtifacts(), repos,
  -                                                                                      
 localRepository, sourceReader );
  +        // interpolation is before injection, because interpolation is off-limits in the
injected variables
  +        modelDefaultsInjector.injectDefaults( model );
   
  -                project.getArtifacts().addAll( result.getArtifacts().values() );
  -            }
  +        MavenProject parentProject = project.getParent();
   
  -            ModelValidationResult validationResult = validator.validate( project.getModel()
);
  +        project = new MavenProject( model );
  +        project.setParent( parentProject );
  +        project.setArtifacts( artifactFactory.createArtifacts( project.getDependencies(),
localRepository, null ) );
   
  -            if ( validationResult.getMessageCount() > 0 )
  -            {
  -                throw new ProjectBuildingException( "Exception while building project:
" + validationResult.toString() );
  -            }
  +        // ----------------------------------------------------------------------
  +        // Typically when the project builder is being used from maven proper
  +        // the transitive dependencies will not be resolved here because this
  +        // requires a lot of work when we may only be interested in running
  +        // something simple like 'm2 clean'. So the artifact collector is used
  +        // in the dependency resolution phase if it is required by any of the
  +        // goals being executed. But when used as a component in another piece
  +        // of code people may just want to build maven projects and have the
  +        // dependencies resolved for whatever reason: this is why we keep
  +        // this snippet of code here.
  +        // ----------------------------------------------------------------------
   
  -            project.setFile( projectDescriptor );
  +        if ( resolveDependencies )
  +        {
  +            List repos = buildArtifactRepositories( project.getRepositories() );
   
  -            pathTranslator.alignToBaseDirectory( project.getModel(), projectDescriptor
);
  +            MavenMetadataSource sourceReader = new MavenMetadataSource( artifactResolver,
this );
   
  -            project.addCompileSourceRoot( project.getBuild().getSourceDirectory() );
  -            project.addScriptSourceRoot( project.getBuild().getScriptSourceDirectory()
);
  -            project.addTestCompileSourceRoot( project.getBuild().getTestSourceDirectory()
);
  +            ArtifactResolutionResult result = artifactResolver.resolveTransitively( project.getArtifacts(),
repos,
  +                                                                                    localRepository,
sourceReader );
   
  -            return project;
  +            project.getArtifacts().addAll( result.getArtifacts().values() );
           }
  -        catch ( Exception e )
  +
  +        ModelValidationResult validationResult = validator.validate( project.getModel()
);
  +
  +        if ( validationResult.getMessageCount() > 0 )
           {
  -            throw new ProjectBuildingException( "Error building project from " + projectDescriptor,
e );
  +            throw new ProjectBuildingException( "Exception while building project: " +
validationResult.toString() );
           }
  +
  +        project.addCompileSourceRoot( project.getBuild().getSourceDirectory() );
  +        project.addScriptSourceRoot( project.getBuild().getScriptSourceDirectory() );
  +        project.addTestCompileSourceRoot( project.getBuild().getTestSourceDirectory() );
  +
  +        return project;
       }
   
       private MavenProject assembleLineage( File projectDescriptor, ArtifactRepository localRepository,
  -                                          LinkedList lineage, List aggregatedRemoteWagonRepositories
)
  +                                         LinkedList lineage, List aggregatedRemoteWagonRepositories
)
           throws ProjectBuildingException
       {
           Model model = readModel( projectDescriptor );
  @@ -245,8 +253,7 @@
           return repos;
       }
   
  -    private Model readModel( File file )
  -        throws ProjectBuildingException
  +    private Model readModel( File file ) throws ProjectBuildingException
       {
           try
           {
  @@ -259,12 +266,12 @@
           catch ( Exception e )
           {
               throw new ProjectBuildingException(
  -                "Error while reading model from file '" + file.getAbsolutePath() + "'.",
e );
  +                                                "Error while reading model from file '"
+ file.getAbsolutePath() + "'.",
  +                                                e );
           }
       }
   
  -    private Model readModel( URL url )
  -        throws ProjectBuildingException
  +    private Model readModel( URL url ) throws ProjectBuildingException
       {
           try
           {
  @@ -293,8 +300,8 @@
           catch ( ArtifactResolutionException e )
           {
               // @todo use parent.toString() if modello could generate it, or specify in
a code segment
  -            throw new ProjectBuildingException( "Missing parent POM: " + parent.getGroupId()
+ ":" +
  -                                                parent.getArtifactId() + "-" + parent.getVersion(),
e );
  +            throw new ProjectBuildingException( "Missing parent POM: " + parent.getGroupId()
+ ":"
  +                + parent.getArtifactId() + "-" + parent.getVersion(), e );
           }
   
           return artifact.getFile();
  @@ -311,8 +318,7 @@
        * <li>do a topo sort on the graph that remains.</li>
        * </ul>
        */
  -    public List getSortedProjects( List projects )
  -        throws CycleDetectedException
  +    public List getSortedProjects( List projects ) throws CycleDetectedException
       {
           DAG dag = new DAG();
   
  @@ -360,15 +366,45 @@
           return sortedProjects;
       }
   
  +    public MavenProject buildSuperProject( ArtifactRepository localRepository )
  +    throws ProjectBuildingException
  +    {
  +            return buildSuperProject( localRepository, false );
  +    }
  +    
  +    public MavenProject buildSuperProject( ArtifactRepository localRepository, boolean
resolveDependencies )
  +        throws ProjectBuildingException
  +    {
  +        MavenProject project = new MavenProject( getSuperModel() );
  +
  +        try
  +        {
  +            project = processProjectLogic( project, localRepository, resolveDependencies
);
  +            
  +            File projectFile = new File( ".", "pom.xml" );
  +            project.setFile( projectFile );
  +            pathTranslator.alignToBaseDirectory( project.getModel(), projectFile );
  +
  +            return project;
  +        }
  +        catch ( ModelInterpolationException e )
  +        {
  +            throw new ProjectBuildingException( "Error building super-project", e );
  +        }
  +        catch ( ArtifactResolutionException e )
  +        {
  +            throw new ProjectBuildingException( "Error building super-project", e );
  +        }
  +    }
  +
       // ----------------------------------------------------------------------
       //
       // ----------------------------------------------------------------------
   
  -    private Model getSuperModel()
  -        throws ProjectBuildingException
  +    private Model getSuperModel() throws ProjectBuildingException
       {
           URL url = DefaultMavenProjectBuilder.class.getResource( "pom-" + MavenConstants.MAVEN_MODEL_VERSION
+ ".xml" );
   
           return readModel( url );
       }
  -}
  +}
  \ No newline at end of file
  
  
  
  1.9       +6 -0      maven-components/maven-core/src/main/java/org/apache/maven/project/MavenProjectBuilder.java
  
  Index: MavenProjectBuilder.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/project/MavenProjectBuilder.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- MavenProjectBuilder.java	1 Mar 2005 06:43:13 -0000	1.8
  +++ MavenProjectBuilder.java	10 Mar 2005 23:01:35 -0000	1.9
  @@ -33,6 +33,12 @@
       MavenProject build( File project, ArtifactRepository localRepository, boolean transitive
)
           throws ProjectBuildingException;
   
  +    MavenProject buildSuperProject( ArtifactRepository localRepository )
  +        throws ProjectBuildingException;
  +
  +    MavenProject buildSuperProject( ArtifactRepository localRepository, boolean transitive
)
  +        throws ProjectBuildingException;
  +
       // take this out
   
       List getSortedProjects( List projects )
  
  
  
  1.26      +29 -0     maven-components/maven-core/src/main/java/org/apache/maven/project/MavenProject.java
  
  Index: MavenProject.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/project/MavenProject.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- MavenProject.java	10 Mar 2005 01:35:14 -0000	1.25
  +++ MavenProject.java	10 Mar 2005 23:01:35 -0000	1.26
  @@ -29,6 +29,8 @@
   import org.apache.maven.model.MailingList;
   import org.apache.maven.model.Model;
   import org.apache.maven.model.Organization;
  +import org.apache.maven.model.Plugin;
  +import org.apache.maven.model.PluginManagement;
   import org.apache.maven.model.Reports;
   import org.apache.maven.model.Scm;
   
  @@ -522,5 +524,32 @@
           }
           return model.getBuild().getPlugins();
       }
  +
  +    public PluginManagement getPluginManagement()
  +    {
  +        PluginManagement pluginMgmt = null;
  +
  +        Build build = model.getBuild();
  +        if ( build != null )
  +        {
  +            pluginMgmt = build.getPluginManagement();
  +        }
  +
  +        return pluginMgmt;
  +    }
  +
  +    public void addPlugin( Plugin plugin )
  +    {
  +        Build build = model.getBuild();
  +
  +        if ( build == null )
  +        {
  +            build = new Build();
  +
  +            model.setBuild( build );
  +        }
  +
  +        build.addPlugin( plugin );
  +    }
   }
   
  
  
  
  1.6       +2 -1      maven-components/maven-model/pom.xml
  
  Index: pom.xml
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-model/pom.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- pom.xml	10 Mar 2005 01:35:13 -0000	1.5
  +++ pom.xml	10 Mar 2005 23:01:35 -0000	1.6
  @@ -16,6 +16,7 @@
         <plugin>
           <groupId>maven</groupId>
           <artifactId>maven-modello-plugin</artifactId>
  +        <version>1.0-SNAPSHOT</version>
           <configuration>
             <version>4.0.0</version>
             <model>maven.mdo</model>
  @@ -23,4 +24,4 @@
         </plugin>
       </plugins>
     </build>
  -</model>
  \ No newline at end of file
  +</model>
  
  
  
  1.84      +11 -11    maven-components/maven-model/maven.mdo
  
  Index: maven.mdo
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-model/maven.mdo,v
  retrieving revision 1.83
  retrieving revision 1.84
  diff -u -r1.83 -r1.84
  --- maven.mdo	10 Mar 2005 01:35:13 -0000	1.83
  +++ maven.mdo	10 Mar 2005 23:01:35 -0000	1.84
  @@ -413,17 +413,6 @@
               <type>DependencyManagement</type>
             </association>
           </field>
  -        <!-- [ jdcasey:06-Mar-2005 ] Added to handle version management, etc. for
  -         | plugins to be used in sub-projects. -->
  -        <field>
  -          <name>pluginManagement</name>
  -          <version>4.0.0</version>
  -          <required>false</required>
  -          <description><![CDATA[Default plugin information for grouped projects
inheriting from this one.]]></description>
  -          <association>
  -            <type>PluginManagement</type>
  -          </association>
  -        </field>
           <field>
             <name>properties</name>
             <version>3.0.0</version>
  @@ -682,6 +671,17 @@
               <multiplicity>*</multiplicity>
             </association>
           </field>
  +        <!-- [ jdcasey:06-Mar-2005 ] Added to handle version management, etc. for
  +         | plugins to be used in sub-projects. -->
  +        <field>
  +          <name>pluginManagement</name>
  +          <version>4.0.0</version>
  +          <required>false</required>
  +          <description><![CDATA[Default plugin information for grouped projects
inheriting from this one.]]></description>
  +          <association>
  +            <type>PluginManagement</type>
  +          </association>
  +        </field>
         </fields>
       </class>
       <class>
  
  
  
  1.8       +49 -47    maven-components/maven-core/src/main/resources/org/apache/maven/project/pom-4.0.0.xml
  
  Index: pom-4.0.0.xml
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/resources/org/apache/maven/project/pom-4.0.0.xml,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- pom-4.0.0.xml	10 Mar 2005 21:36:57 -0000	1.7
  +++ pom-4.0.0.xml	10 Mar 2005 23:01:35 -0000	1.8
  @@ -30,53 +30,55 @@
         </testResource>
       </testResources>
       <!-- Default plugins -->
  -    <plugins>
  -      <plugin>
  -        <groupId>maven</groupId>
  -        <artifactId>maven-compiler-plugin</artifactId>
  -        <version>1.0-SNAPSHOT</version>
  -      </plugin>
  -      <plugin>
  -        <groupId>maven</groupId>
  -        <artifactId>maven-resources-plugin</artifactId>
  -        <version>1.0-SNAPSHOT</version>
  -      </plugin>
  -      <plugin>
  -        <groupId>maven</groupId>
  -        <artifactId>maven-jar-plugin</artifactId>
  -        <version>1.0-SNAPSHOT</version>
  -      </plugin>
  -      <plugin>
  -        <groupId>maven</groupId>
  -        <artifactId>maven-surefire-plugin</artifactId>
  -        <version>1.0-SNAPSHOT</version>
  -      </plugin>
  -      <plugin>
  -        <groupId>maven</groupId>
  -        <artifactId>maven-clean-plugin</artifactId>
  -        <version>1.0-SNAPSHOT</version>
  -      </plugin>
  -      <plugin>
  -        <groupId>maven</groupId>
  -        <artifactId>maven-deploy-plugin</artifactId>
  -        <version>1.0-SNAPSHOT</version>
  -      </plugin>
  -      <plugin>
  -        <groupId>maven</groupId>
  -        <artifactId>maven-install-plugin</artifactId>
  -        <version>1.0-SNAPSHOT</version>
  -      </plugin>
  -      <plugin>
  -        <groupId>maven</groupId>
  -        <artifactId>maven-pom-plugin</artifactId>
  -        <version>1.0-SNAPSHOT</version>
  -      </plugin>
  -      <plugin>
  -        <groupId>maven</groupId>
  -        <artifactId>maven-plugin-plugin</artifactId>
  -        <version>1.0-SNAPSHOT</version>
  -      </plugin>
  -    </plugins>
  +    <pluginManagement>
  +      <plugins>
  +        <plugin>
  +          <groupId>maven</groupId>
  +          <artifactId>maven-compiler-plugin</artifactId>
  +          <version>1.0-SNAPSHOT</version>
  +        </plugin>
  +        <plugin>
  +          <groupId>maven</groupId>
  +          <artifactId>maven-resources-plugin</artifactId>
  +          <version>1.0-SNAPSHOT</version>
  +        </plugin>
  +        <plugin>
  +          <groupId>maven</groupId>
  +          <artifactId>maven-jar-plugin</artifactId>
  +          <version>1.0-SNAPSHOT</version>
  +        </plugin>
  +        <plugin>
  +          <groupId>maven</groupId>
  +          <artifactId>maven-surefire-plugin</artifactId>
  +          <version>1.0-SNAPSHOT</version>
  +        </plugin>
  +        <plugin>
  +          <groupId>maven</groupId>
  +          <artifactId>maven-clean-plugin</artifactId>
  +          <version>1.0-SNAPSHOT</version>
  +        </plugin>
  +        <plugin>
  +          <groupId>maven</groupId>
  +          <artifactId>maven-deploy-plugin</artifactId>
  +          <version>1.0-SNAPSHOT</version>
  +        </plugin>
  +        <plugin>
  +          <groupId>maven</groupId>
  +          <artifactId>maven-install-plugin</artifactId>
  +          <version>1.0-SNAPSHOT</version>
  +        </plugin>
  +        <plugin>
  +          <groupId>maven</groupId>
  +          <artifactId>maven-pom-plugin</artifactId>
  +          <version>1.0-SNAPSHOT</version>
  +        </plugin>
  +        <plugin>
  +          <groupId>maven</groupId>
  +          <artifactId>maven-plugin-plugin</artifactId>
  +          <version>1.0-SNAPSHOT</version>
  +        </plugin>
  +      </plugins>
  +    </pluginManagement>
     </build>
   </project>
   
  
  
  
  1.6       +3 -2      maven-components/maven-core/src/main/java/org/apache/maven/execution/MavenInitializingExecutionRequest.java
  
  Index: MavenInitializingExecutionRequest.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/execution/MavenInitializingExecutionRequest.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- MavenInitializingExecutionRequest.java	9 Mar 2005 22:13:05 -0000	1.5
  +++ MavenInitializingExecutionRequest.java	10 Mar 2005 23:01:35 -0000	1.6
  @@ -21,6 +21,7 @@
   import org.apache.maven.model.user.UserModel;
   import org.apache.maven.monitor.event.EventDispatcher;
   
  +import java.util.Collections;
   import java.util.List;
   
   /**
  @@ -39,6 +40,6 @@
   
       public List getProjectFiles()
       {
  -        return null;
  +        return Collections.EMPTY_LIST;
       }
   }
  
  
  
  1.20      +34 -1     maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
  
  Index: DefaultLifecycleExecutor.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- DefaultLifecycleExecutor.java	10 Mar 2005 09:19:53 -0000	1.19
  +++ DefaultLifecycleExecutor.java	10 Mar 2005 23:01:36 -0000	1.20
  @@ -22,6 +22,7 @@
   import org.apache.maven.execution.MavenExecutionResponse;
   import org.apache.maven.execution.MavenSession;
   import org.apache.maven.model.Plugin;
  +import org.apache.maven.model.PluginManagement;
   import org.apache.maven.monitor.event.EventDispatcher;
   import org.apache.maven.monitor.event.MavenEvents;
   import org.apache.maven.plugin.PluginExecutionResponse;
  @@ -81,9 +82,11 @@
   
           try
           {
  +            MavenProject project = session.getProject();
  +            
               // TODO: should enrich this with the type handler, but for now just
               // use "type" as is
  -            ArtifactHandler handler = artifactHandlerManager.getArtifactHandler( session.getProject().getPackaging()
);
  +            ArtifactHandler handler = artifactHandlerManager.getArtifactHandler( project.getPackaging()
);
   
               if ( handler != null )
               {
  @@ -96,6 +99,11 @@
                   }
                   if ( handler.additionalPlugin() != null )
                   {
  +                    String additionalPluginGroupId = "maven";
  +                    String additionalPluginArtifactId = "maven-" + handler.additionalPlugin()
+ "-plugin";
  +
  +                    injectHandlerPluginConfiguration( project, additionalPluginGroupId,
additionalPluginArtifactId );
  +
                       processPluginPhases( "maven", "maven-" + handler.additionalPlugin()
+ "-plugin", session );
                   }
               }
  @@ -139,6 +147,31 @@
           return response;
       }
   
  +    private void injectHandlerPluginConfiguration( MavenProject project, String groupId,
String artifactId )
  +    {
  +        PluginManagement mgmt = project.getPluginManagement();
  +        if( mgmt != null )
  +        {
  +            List pluginList = mgmt.getPlugins();
  +
  +            Plugin handlerPlugin = null;
  +            for ( Iterator it = pluginList.iterator(); it.hasNext(); )
  +            {
  +                Plugin plugin = (Plugin) it.next();
  +                if ( groupId.equals( plugin.getGroupId() ) && artifactId.equals(
plugin.getArtifactId() ) )
  +                {
  +                    handlerPlugin = plugin;
  +                    break;
  +                }
  +            }
  +
  +            if ( handlerPlugin != null )
  +            {
  +                project.addPlugin( handlerPlugin );
  +            }
  +        }
  +    }
  +
       // TODO: don't throw Exception
       private void processPluginConfiguration( MavenProject project, MavenSession mavenSession
)
           throws Exception
  
  
  
  1.3       +2 -1      maven-components/maven-user-model/pom.xml
  
  Index: pom.xml
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-user-model/pom.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- pom.xml	10 Mar 2005 01:35:13 -0000	1.2
  +++ pom.xml	10 Mar 2005 23:01:36 -0000	1.3
  @@ -12,6 +12,7 @@
         <plugin>
           <groupId>maven</groupId>
           <artifactId>maven-modello-plugin</artifactId>
  +        <version>1.0-SNAPSHOT</version>
           <configuration>
             <version>4.0.0</version>
             <model>maven-user.mdo</model>
  @@ -19,4 +20,4 @@
         </plugin>
       </plugins>
     </build>
  -</model>
  \ No newline at end of file
  +</model>
  
  
  
  1.20      +53 -36    maven-components/maven-core/src/main/java/org/apache/maven/project/inheritance/DefaultModelInheritanceAssembler.java
  
  Index: DefaultModelInheritanceAssembler.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/project/inheritance/DefaultModelInheritanceAssembler.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- DefaultModelInheritanceAssembler.java	10 Mar 2005 01:35:14 -0000	1.19
  +++ DefaultModelInheritanceAssembler.java	10 Mar 2005 23:01:36 -0000	1.20
  @@ -219,66 +219,83 @@
   
       private void assemblePluginManagementInheritance( Model child, Model parent )
       {
  -        PluginManagement parentPluginMgmt = parent.getPluginManagement();
  -
  -        PluginManagement childPluginMgmt = child.getPluginManagement();
  +        Build parentBuild = parent.getBuild();
  +        Build childBuild = parent.getBuild();
   
  -        if ( parentPluginMgmt != null )
  +        if ( childBuild == null )
           {
  -            if ( childPluginMgmt == null )
  +            if ( parentBuild != null )
               {
  -                child.setPluginManagement( parentPluginMgmt );
  +                child.setBuild( parentBuild );
               }
               else
               {
  -                List childPlugins = childPluginMgmt.getPlugins();
  +                childBuild = new Build();
  +            }
  +        }
  +        else
  +        {
  +            PluginManagement parentPluginMgmt = parentBuild.getPluginManagement();
   
  -                Map mappedChildPlugins = new TreeMap();
  -                for ( Iterator it = childPlugins.iterator(); it.hasNext(); )
  +            PluginManagement childPluginMgmt = childBuild.getPluginManagement();
  +
  +            if ( parentPluginMgmt != null )
  +            {
  +                if ( childPluginMgmt == null )
                   {
  -                    Plugin plugin = (Plugin) it.next();
  -                    mappedChildPlugins.put( constructPluginKey( plugin ), plugin );
  +                    childBuild.setPluginManagement( parentPluginMgmt );
                   }
  -
  -                for ( Iterator it = parentPluginMgmt.getPlugins().iterator(); it.hasNext();
)
  +                else
                   {
  -                    Plugin plugin = (Plugin) it.next();
  -                    if ( !mappedChildPlugins.containsKey( constructPluginKey( plugin )
) )
  +                    List childPlugins = childPluginMgmt.getPlugins();
  +
  +                    Map mappedChildPlugins = new TreeMap();
  +                    for ( Iterator it = childPlugins.iterator(); it.hasNext(); )
                       {
  -                        childPluginMgmt.addPlugin( plugin );
  +                        Plugin plugin = (Plugin) it.next();
  +                        mappedChildPlugins.put( constructPluginKey( plugin ), plugin );
                       }
  -                    else
  -                    {
  -                        Plugin childPlugin = (Plugin) mappedChildPlugins.get( constructPluginKey(
plugin ) );
   
  -                        Map mappedChildGoals = new TreeMap();
  -                        for ( Iterator itGoals = childPlugin.getGoals().iterator(); itGoals.hasNext();
)
  +                    for ( Iterator it = parentPluginMgmt.getPlugins().iterator(); it.hasNext();
)
  +                    {
  +                        Plugin plugin = (Plugin) it.next();
  +                        if ( !mappedChildPlugins.containsKey( constructPluginKey( plugin
) ) )
                           {
  -                            Goal goal = (Goal) itGoals.next();
  -                            mappedChildGoals.put( goal.getId(), goal );
  +                            childPluginMgmt.addPlugin( plugin );
                           }
  -
  -                        for ( Iterator itGoals = plugin.getGoals().iterator(); itGoals.hasNext();
)
  +                        else
                           {
  -                            Goal parentGoal = (Goal) itGoals.next();
  -                            Goal childGoal = (Goal) mappedChildGoals.get( parentGoal.getId()
);
  +                            Plugin childPlugin = (Plugin) mappedChildPlugins.get( constructPluginKey(
plugin ) );
   
  -                            if ( childGoal == null )
  +                            Map mappedChildGoals = new TreeMap();
  +                            for ( Iterator itGoals = childPlugin.getGoals().iterator();
itGoals.hasNext(); )
                               {
  -                                childPlugin.addGoal( parentGoal );
  +                                Goal goal = (Goal) itGoals.next();
  +                                mappedChildGoals.put( goal.getId(), goal );
                               }
  -                            else
  +
  +                            for ( Iterator itGoals = plugin.getGoals().iterator(); itGoals.hasNext();
)
                               {
  -                                Boolean disabled = childGoal.isDisabled();
  -                                if ( disabled == null )
  +                                Goal parentGoal = (Goal) itGoals.next();
  +                                Goal childGoal = (Goal) mappedChildGoals.get( parentGoal.getId()
);
  +
  +                                if ( childGoal == null )
  +                                {
  +                                    childPlugin.addGoal( parentGoal );
  +                                }
  +                                else
                                   {
  -                                    childGoal.setDisabled( parentGoal.isDisabled() );
  +                                    Boolean disabled = childGoal.isDisabled();
  +                                    if ( disabled == null )
  +                                    {
  +                                        childGoal.setDisabled( parentGoal.isDisabled()
);
   
  -                                    Properties conf = new Properties( childGoal.getConfiguration()
);
  +                                        Properties conf = new Properties( childGoal.getConfiguration()
);
   
  -                                    conf.putAll( parentGoal.getConfiguration() );
  +                                        conf.putAll( parentGoal.getConfiguration() );
   
  -                                    childGoal.setConfiguration( conf );
  +                                        childGoal.setConfiguration( conf );
  +                                    }
                                   }
                               }
                           }
  
  
  
  1.6       +1 -1      maven-components/maven-core/src/main/java/org/apache/maven/project/injection/DefaultModelDefaultsInjector.java
  
  Index: DefaultModelDefaultsInjector.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/project/injection/DefaultModelDefaultsInjector.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DefaultModelDefaultsInjector.java	10 Mar 2005 01:35:14 -0000	1.5
  +++ DefaultModelDefaultsInjector.java	10 Mar 2005 23:01:37 -0000	1.6
  @@ -42,7 +42,7 @@
           injectDependencyDefaults( model.getDependencies(), model.getDependencyManagement()
);
           if ( model.getBuild() != null )
           {
  -            injectPluginDefaults( model.getBuild().getPlugins(), model.getPluginManagement()
);
  +            injectPluginDefaults( model.getBuild().getPlugins(), model.getBuild().getPluginManagement()
);
           }
       }
   
  
  
  
  1.26      +12 -2     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.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- DefaultMaven.java	9 Mar 2005 22:13:07 -0000	1.25
  +++ DefaultMaven.java	10 Mar 2005 23:01:38 -0000	1.26
  @@ -97,7 +97,17 @@
       {
           MavenSession session = createSession( request );
   
  -        MavenProject project = getProject( (File) request.getProjectFiles().get( 0 ), request.getLocalRepository()
);
  +        List projectFiles = request.getProjectFiles();
  +        
  +        MavenProject project = null;
  +        if(projectFiles != null && !projectFiles.isEmpty())
  +        {
  +            project = getProject( (File) request.getProjectFiles().get( 0 ), request.getLocalRepository()
);
  +        }
  +        else
  +        {
  +            project = projectBuilder.buildSuperProject( request.getLocalRepository() );
  +        }
   
           session.setProject( project );
   
  
  
  

Mime
View raw message