jdcasey     2005/03/18 14:02:09

  Modified:    maven-core/src/main/java/org/apache/maven/project
                        MavenProjectBuilder.java
                        DefaultMavenProjectBuilder.java MavenProject.java
               maven-mboot2/src/main/java MBoot.java
               
maven-archetype/maven-archetype-core/src/test/java/org/apache/maven/archetype
                        ArchetypeTest.java
               maven-artifact/src/main/java/org/apache/maven/artifact/resolver
                        DefaultArtifactResolver.java
               
maven-archetype/maven-archetype-core/src/main/resources/META-INF/plexus
                        components.xml
               maven-artifact/src/main/java/org/apache/maven/artifact
                        DefaultArtifact.java
               
maven-archetype/maven-archetype-core/src/main/java/org/apache/maven/archetype
                        DefaultArchetype.java Archetype.java
               
maven-archetype/maven-archetype-plugin/src/main/java/org/apache/maven/plugin/archetype
                        MavenArchetypePlugin.java
               maven-archetype/maven-archetype-plugin pom.xml
               maven-core/src/main/java/org/apache/maven/artifact/factory
                        DefaultArtifactFactory.java
               maven-core/src/main/java/org/apache/maven DefaultMaven.java
  Added:       
maven-artifact/src/main/java/org/apache/maven/artifact/construction
                        ArtifactConstructionSupport.java
  Log:
  o Created non-abstract base class for DefaultArtifactFactory to extend, 
called ArtifactConstructionSupport, which provides centralized means for 
constructing artifacts consistently without all the maven-core specific 
methods. These maven-core specifics not delegate to the generic methods 
provided in this new class.
  o Adjusted the maven-archetype stuff to work with the new artifact 
creation/resolution/etc. methods in maven-artifact and maven-core.
  o Removed all direct construction of DefaultArtifact and replaced with 
ArtifactConstructionSupport where it would have involved putting the 
DefaultArtifactFactory in the plexus.xml, and where the code doesn't need 
dependency-oriented methods.
  o Archetype works now, using the example provided in 
plexus/plexus-site/src/site/apt/building-plexus-applications.apt
  
  Revision  Changes    Path
  1.15      +7 -1      
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.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- MavenProjectBuilder.java  16 Mar 2005 06:56:03 -0000      1.14
  +++ MavenProjectBuilder.java  18 Mar 2005 22:02:08 -0000      1.15
  @@ -26,6 +26,12 @@
   public interface MavenProjectBuilder
   {
       String ROLE = MavenProjectBuilder.class.getName();
  +    
  +    static final String STANDALONE_SUPERPOM_GROUPID = "maven";
  +    
  +    static final String STANDALONE_SUPERPOM_ARTIFACTID = "super-pom";
  +    
  +    static final String STANDALONE_SUPERPOM_VERSION = "2.0";
   
       MavenProject build( File project, ArtifactRepository localRepository )
           throws ProjectBuildingException;
  @@ -36,7 +42,7 @@
       MavenProject buildFromRepository( Artifact artifact, ArtifactRepository 
localRepository )
           throws ProjectBuildingException;
   
  -    MavenProject buildSuperProject( ArtifactRepository localRepository )
  +    MavenProject buildStandaloneSuperProject( ArtifactRepository 
localRepository )
           throws ProjectBuildingException;
   
       Model getCachedModel( String groupId, String artifactId, String version 
);
  
  
  
  1.54      +10 -2     
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.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- DefaultMavenProjectBuilder.java   17 Mar 2005 02:04:35 -0000      1.53
  +++ DefaultMavenProjectBuilder.java   18 Mar 2005 22:02:08 -0000      1.54
  @@ -377,10 +377,18 @@
           return groupId + ":" + artifactId + ":" + version;
       }
   
  -    public MavenProject buildSuperProject( ArtifactRepository 
localRepository )
  +    public MavenProject buildStandaloneSuperProject( ArtifactRepository 
localRepository )
           throws ProjectBuildingException
       {
  -        MavenProject project = new MavenProject( getSuperModel() );
  +        Model superModel = getSuperModel();
  +        
  +        superModel.setGroupId( STANDALONE_SUPERPOM_GROUPID );
  +
  +        superModel.setArtifactId( STANDALONE_SUPERPOM_ARTIFACTID );
  +
  +        superModel.setVersion( STANDALONE_SUPERPOM_VERSION );
  +        
  +        MavenProject project = new MavenProject( superModel );
   
           try
           {
  
  
  
  1.31      +11 -4     
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.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- MavenProject.java 17 Mar 2005 02:04:35 -0000      1.30
  +++ MavenProject.java 18 Mar 2005 22:02:08 -0000      1.31
  @@ -18,7 +18,7 @@
    */
   
   import org.apache.maven.artifact.Artifact;
  -import org.apache.maven.artifact.DefaultArtifact;
  +import org.apache.maven.artifact.construction.ArtifactConstructionSupport;
   import org.apache.maven.model.Build;
   import org.apache.maven.model.CiManagement;
   import org.apache.maven.model.Contributor;
  @@ -74,6 +74,8 @@
       private Set artifacts;
   
       private List collectedProjects = Collections.EMPTY_LIST;
  +    
  +    private ArtifactConstructionSupport artifactConstructionSupport = new 
ArtifactConstructionSupport();
   
       public MavenProject( Model model )
       {
  @@ -682,9 +684,14 @@
                   if ( updateScope )
                   {
                       // TODO: Artifact factory?
  -                    Artifact artifact = new DefaultArtifact( 
existing.getGroupId(), existing.getArtifactId(),
  -                                                             
existing.getVersion(), a.getScope(), existing.getType(),
  -                                                             
existing.getExtension() );
  +                    // TODO: [jc] Is this a better way to centralize 
artifact construction here?
  +                    Artifact artifact = 
artifactConstructionSupport.createArtifact( existing.getGroupId(), 
  +                                                                             
       existing.getArtifactId(), 
  +                                                                             
       existing.getVersion(), 
  +                                                                             
       a.getScope(), 
  +                                                                             
       existing.getType(),
  +                                                                             
       existing.getExtension() );
  +
                       artifacts.put( id, artifact );
                   }
               }
  
  
  
  1.72      +1 -0      maven-components/maven-mboot2/src/main/java/MBoot.java
  
  Index: MBoot.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-mboot2/src/main/java/MBoot.java,v
  retrieving revision 1.71
  retrieving revision 1.72
  diff -u -r1.71 -r1.72
  --- MBoot.java        17 Mar 2005 23:59:07 -0000      1.71
  +++ MBoot.java        18 Mar 2005 22:02:08 -0000      1.72
  @@ -54,6 +54,7 @@
   
       String[] pluginGeneratorDeps = new 
String[]{"plexus/jars/plexus-container-default-1.0-alpha-2-SNAPSHOT.jar",
                                                   
"maven/jars/maven-core-2.0-SNAPSHOT.jar",
  +                                                
"maven/jars/maven-artifact-2.0-SNAPSHOT.jar",
                                                   
"maven/jars/maven-model-2.0-SNAPSHOT.jar",
                                                   
"maven/jars/maven-plugin-2.0-SNAPSHOT.jar",
                                                   
"maven/jars/maven-plugin-tools-api-2.0-SNAPSHOT.jar",
  
  
  
  1.3       +8 -8      
maven-components/maven-archetype/maven-archetype-core/src/test/java/org/apache/maven/archetype/ArchetypeTest.java
  
  Index: ArchetypeTest.java
  ===================================================================
  RCS file: 
/home/cvs/maven-components/maven-archetype/maven-archetype-core/src/test/java/org/apache/maven/archetype/ArchetypeTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ArchetypeTest.java        6 Jan 2005 13:03:10 -0000       1.2
  +++ ArchetypeTest.java        18 Mar 2005 22:02:08 -0000      1.3
  @@ -16,16 +16,16 @@
    * limitations under the License.
    */
   
  -import org.codehaus.plexus.PlexusTestCase;
   import org.apache.maven.artifact.repository.ArtifactRepository;
  +import org.codehaus.plexus.PlexusTestCase;
   
  -import java.util.Map;
  -import java.util.HashMap;
  -import java.util.HashSet;
  -import java.util.Set;
  -import java.util.Properties;
   import java.io.File;
   import java.io.FileInputStream;
  +import java.util.ArrayList;
  +import java.util.HashMap;
  +import java.util.List;
  +import java.util.Map;
  +import java.util.Properties;
   
   /**
    * @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
  @@ -65,7 +65,7 @@
   
           ArtifactRepository localRepository = new ArtifactRepository( 
"local", "file://" + mavenProperties.getProperty( "maven.repo.local" ) );
   
  -        Set remoteRepositories = new HashSet();
  +        List remoteRepositories = new ArrayList();
   
           ArtifactRepository remoteRepository = new ArtifactRepository( 
"remote", "http://repo1.maven.org"; );
   
  
  
  
  1.19      +9 -5      
maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java
  
  Index: DefaultArtifactResolver.java
  ===================================================================
  RCS file: 
/home/cvs/maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- DefaultArtifactResolver.java      17 Mar 2005 00:17:26 -0000      1.18
  +++ DefaultArtifactResolver.java      18 Mar 2005 22:02:09 -0000      1.19
  @@ -2,7 +2,7 @@
   
   import org.apache.maven.artifact.AbstractArtifactComponent;
   import org.apache.maven.artifact.Artifact;
  -import org.apache.maven.artifact.DefaultArtifact;
  +import org.apache.maven.artifact.construction.ArtifactConstructionSupport;
   import 
org.apache.maven.artifact.handler.manager.ArtifactHandlerNotFoundException;
   import org.apache.maven.artifact.manager.WagonManager;
   import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
  @@ -45,6 +45,8 @@
       // ----------------------------------------------------------------------
       // Implementation
       // ----------------------------------------------------------------------
  +    
  +    private ArtifactConstructionSupport artifactConstructionSupport = new 
ArtifactConstructionSupport();
   
       public Artifact resolve( Artifact artifact, List remoteRepositories, 
ArtifactRepository localRepository )
           throws ArtifactResolutionException
  @@ -228,10 +230,12 @@
                       if ( updateScope )
                       {
                           // TODO: Artifact factory?
  -                        Artifact artifact = new DefaultArtifact( 
knownArtifact.getGroupId(),
  -                                                                 
knownArtifact.getArtifactId(), knownVersion,
  -                                                                 
newArtifact.getScope(), knownArtifact.getType(),
  -                                                                 
knownArtifact.getExtension() );
  +                        // TODO: [jc] Is this a better way to centralize 
artifact construction here?
  +                        Artifact artifact = 
artifactConstructionSupport.createArtifact( knownArtifact.getGroupId(), 
  +                                                                             
           knownArtifact.getArtifactId(), 
  +                                                                             
           knownVersion, newArtifact.getScope(), 
  +                                                                             
           knownArtifact.getType(),
  +                                                                             
           knownArtifact.getExtension() );
                           resolvedArtifacts.put( artifact.getConflictId(), 
artifact );
                       }
                   }
  
  
  
  1.2       +0 -3      
maven-components/maven-archetype/maven-archetype-core/src/main/resources/META-INF/plexus/components.xml
  
  Index: components.xml
  ===================================================================
  RCS file: 
/home/cvs/maven-components/maven-archetype/maven-archetype-core/src/main/resources/META-INF/plexus/components.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- components.xml    29 Dec 2004 06:20:52 -0000      1.1
  +++ components.xml    18 Mar 2005 22:02:09 -0000      1.2
  @@ -8,9 +8,6 @@
             <role>org.codehaus.plexus.velocity.VelocityComponent</role>
           </requirement>
           <requirement>
  -          <role>org.apache.maven.artifact.manager.WagonManager</role>
  -        </requirement>
  -        <requirement>
             <role>org.apache.maven.artifact.resolver.ArtifactResolver</role>
           </requirement>
         </requirements>
  
  
  
  1.11      +7 -1      
maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/DefaultArtifact.java
  
  Index: DefaultArtifact.java
  ===================================================================
  RCS file: 
/home/cvs/maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/DefaultArtifact.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- DefaultArtifact.java      14 Mar 2005 07:24:23 -0000      1.10
  +++ DefaultArtifact.java      18 Mar 2005 22:02:09 -0000      1.11
  @@ -25,6 +25,7 @@
   public class DefaultArtifact
       implements Artifact
   {
  +    
       // ----------------------------------------------------------------------
       // These are the only things i need to specify
       // ----------------------------------------------------------------------
  @@ -48,6 +49,11 @@
        */
       public DefaultArtifact( String groupId, String artifactId, String 
version, String scope, String type, String extension )
       {
  +        if(type == null)
  +        {
  +            throw new NullPointerException("Artifact type cannot be null.");
  +        }
  +
           this.groupId = groupId;
   
           this.artifactId = artifactId;
  
  
  
  1.1                  
maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/construction/ArtifactConstructionSupport.java
  
  Index: ArtifactConstructionSupport.java
  ===================================================================
  package org.apache.maven.artifact.construction;
  
  import org.apache.maven.artifact.Artifact;
  import org.apache.maven.artifact.DefaultArtifact;
  
  /* ====================================================================
   *   Copyright 2001-2004 The Apache Software Foundation.
   *
   *   Licensed under the Apache License, Version 2.0 (the "License");
   *   you may not use this file except in compliance with the License.
   *   You may obtain a copy of the License at
   *
   *       http://www.apache.org/licenses/LICENSE-2.0
   *
   *   Unless required by applicable law or agreed to in writing, software
   *   distributed under the License is distributed on an "AS IS" BASIS,
   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *   See the License for the specific language governing permissions and
   *   limitations under the License.
   * ====================================================================
   */
  
  /**
   * @author jdcasey
   */
  public class ArtifactConstructionSupport
  {
      
      public Artifact createArtifact( String groupId, String artifactId, String 
version, String scope, String type )
      {
          return createArtifact( groupId, artifactId, version, scope, type, 
type, null );
      }
      
      public Artifact createArtifact( String groupId, String artifactId, String 
version, String scope, String type, String extension )
      {
          return createArtifact( groupId, artifactId, version, scope, type, 
extension, null );
      }
      
      public Artifact createArtifact( String groupId, String artifactId, String 
version, String scope, String type,
                                      String extension, String inheritedScope )
      {
          // TODO: can refactor, use scope handler
  
          // if this artifact is test, and the dependency is test, don't 
transitively create
          if ( Artifact.SCOPE_TEST.equals( inheritedScope ) && 
Artifact.SCOPE_TEST.equals( scope ) )
          {
              return null;
          }
  
          // TODO: localRepository not used (should be used here to resolve 
path?
          String desiredScope = Artifact.SCOPE_RUNTIME;
          if ( Artifact.SCOPE_COMPILE.equals( scope ) && inheritedScope == null 
)
          {
              desiredScope = Artifact.SCOPE_COMPILE;
          }
  
          // vvv added to retain compile scope. Remove if you want compile 
inherited as runtime
          else if ( Artifact.SCOPE_COMPILE.equals( scope ) && 
Artifact.SCOPE_COMPILE.equals( inheritedScope ) )
          {
              desiredScope = Artifact.SCOPE_COMPILE;
          }
          // ^^^ added to retain compile scope. Remove if you want compile 
inherited as runtime
  
          if ( Artifact.SCOPE_TEST.equals( scope ) || 
Artifact.SCOPE_TEST.equals( inheritedScope ) )
          {
              desiredScope = Artifact.SCOPE_TEST;
          }
          
          return new DefaultArtifact( groupId, artifactId, version, 
desiredScope, type, extension );
      }
  }
  
  
  
  1.5       +10 -11    
maven-components/maven-archetype/maven-archetype-core/src/main/java/org/apache/maven/archetype/DefaultArchetype.java
  
  Index: DefaultArchetype.java
  ===================================================================
  RCS file: 
/home/cvs/maven-components/maven-archetype/maven-archetype-core/src/main/java/org/apache/maven/archetype/DefaultArchetype.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DefaultArchetype.java     6 Jan 2005 16:41:58 -0000       1.4
  +++ DefaultArchetype.java     18 Mar 2005 22:02:09 -0000      1.5
  @@ -26,12 +26,11 @@
   import java.util.Iterator;
   import java.util.List;
   import java.util.Map;
  -import java.util.Set;
   
   import org.apache.maven.archetype.descriptor.ArchetypeDescriptor;
   import org.apache.maven.archetype.descriptor.ArchetypeDescriptorBuilder;
   import org.apache.maven.artifact.Artifact;
  -import org.apache.maven.artifact.manager.WagonManager;
  +import org.apache.maven.artifact.construction.ArtifactConstructionSupport;
   import org.apache.maven.artifact.repository.ArtifactRepository;
   import org.apache.maven.artifact.resolver.ArtifactResolutionException;
   import org.apache.maven.artifact.resolver.ArtifactResolver;
  @@ -54,33 +53,33 @@
       // ----------------------------------------------------------------------
   
       private VelocityComponent velocity;
  -
  -    private WagonManager wagonManager;
  -
  +    
       private ArtifactResolver artifactResolver;
   
       // ----------------------------------------------------------------------
       // Implementation
       // ----------------------------------------------------------------------
  +    
  +    private ArtifactConstructionSupport artifactConstructionSupport = new 
ArtifactConstructionSupport();
   
       // groupId = maven
       // artifactId = maven-foo-archetype
       // version = latest
   
       public void createArchetype( String archetypeGroupId, String 
archetypeArtifactId, String archetypeVersion,
  -                                 ArtifactRepository localRepository, Set 
remoteRepositories, Map parameters )
  +                                 ArtifactRepository localRepository, List 
remoteRepositories, Map parameters )
           throws ArchetypeNotFoundException, ArchetypeDescriptorException, 
ArchetypeTemplateProcessingException
       {
           // 
----------------------------------------------------------------------
           // Download the archetype
           // 
----------------------------------------------------------------------
   
  -        Artifact archetypeJar =
  -            wagonManager.createArtifact( archetypeGroupId, 
archetypeArtifactId, archetypeVersion, "jar" );
  +        Artifact archetypeArtifact =
  +            artifactConstructionSupport.createArtifact( archetypeGroupId, 
archetypeArtifactId, archetypeVersion, Artifact.SCOPE_RUNTIME, "jar" );
   
           try
           {
  -            artifactResolver.resolve( archetypeJar, remoteRepositories, 
localRepository );
  +            artifactResolver.resolve( archetypeArtifact, remoteRepositories, 
localRepository );
           }
           catch ( ArtifactResolutionException e )
           {
  @@ -107,7 +106,7 @@
           {
               URL[] urls = new URL[1];
   
  -            urls[0] = archetypeJar.getFile().toURL();
  +            urls[0] = archetypeArtifact.getFile().toURL();
   
               archetypeJarLoader = new URLClassLoader( urls );
   
  
  
  
  1.3       +3 -3      
maven-components/maven-archetype/maven-archetype-core/src/main/java/org/apache/maven/archetype/Archetype.java
  
  Index: Archetype.java
  ===================================================================
  RCS file: 
/home/cvs/maven-components/maven-archetype/maven-archetype-core/src/main/java/org/apache/maven/archetype/Archetype.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Archetype.java    6 Jan 2005 13:03:10 -0000       1.2
  +++ Archetype.java    18 Mar 2005 22:02:09 -0000      1.3
  @@ -16,8 +16,8 @@
    * limitations under the License.
    */
   
  +import java.util.List;
   import java.util.Map;
  -import java.util.Set;
   
   import org.apache.maven.artifact.repository.ArtifactRepository;
   
  @@ -36,6 +36,6 @@
       String ARCHETYPE_POM = "pom.xml";
   
       void createArchetype( String archetypeGroupId, String 
archetypeArtifactId, String archetypeVersion,
  -                          ArtifactRepository localRepository, Set 
remoteRepositories, Map parameters )
  +                          ArtifactRepository localRepository, List 
remoteRepositories, Map parameters )
           throws ArchetypeNotFoundException, ArchetypeDescriptorException, 
ArchetypeTemplateProcessingException;
   }
  
  
  
  1.3       +3 -3      
maven-components/maven-archetype/maven-archetype-plugin/src/main/java/org/apache/maven/plugin/archetype/MavenArchetypePlugin.java
  
  Index: MavenArchetypePlugin.java
  ===================================================================
  RCS file: 
/home/cvs/maven-components/maven-archetype/maven-archetype-plugin/src/main/java/org/apache/maven/plugin/archetype/MavenArchetypePlugin.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MavenArchetypePlugin.java 6 Jan 2005 13:03:10 -0000       1.2
  +++ MavenArchetypePlugin.java 18 Mar 2005 22:02:09 -0000      1.3
  @@ -22,8 +22,8 @@
   import org.apache.maven.plugin.PluginExecutionRequest;
   import org.apache.maven.plugin.PluginExecutionResponse;
   
  -import java.util.HashSet;
  -import java.util.Set;
  +import java.util.ArrayList;
  +import java.util.List;
   
   /**
    * @goal create
  @@ -131,7 +131,7 @@
   
           ArtifactRepository localRepository = (ArtifactRepository) 
request.getParameter( "localRepository" );
   
  -        Set remoteRepositories = new HashSet();
  +        List remoteRepositories = new ArrayList();
   
           ArtifactRepository remoteRepository = new ArtifactRepository( 
"remote", "http://repo1.maven.org"; );
   
  
  
  
  1.3       +1 -1      
maven-components/maven-archetype/maven-archetype-plugin/pom.xml
  
  Index: pom.xml
  ===================================================================
  RCS file: 
/home/cvs/maven-components/maven-archetype/maven-archetype-plugin/pom.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- pom.xml   10 Mar 2005 01:35:17 -0000      1.2
  +++ pom.xml   18 Mar 2005 22:02:09 -0000      1.3
  @@ -7,7 +7,7 @@
     <modelVersion>4.0.0</modelVersion>
     <groupId>maven</groupId>
     <artifactId>maven-archetype-plugin</artifactId>
  -  <packaging>plugin</packaging>
  +  <packaging>maven-plugin</packaging>
     <name>Maven Archetype Plugin</name>
     <version>1.0-SNAPSHOT</version>
     <dependencies>
  
  
  
  1.10      +2 -32     
maven-components/maven-core/src/main/java/org/apache/maven/artifact/factory/DefaultArtifactFactory.java
  
  Index: DefaultArtifactFactory.java
  ===================================================================
  RCS file: 
/home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/artifact/factory/DefaultArtifactFactory.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- DefaultArtifactFactory.java       17 Mar 2005 02:04:34 -0000      1.9
  +++ DefaultArtifactFactory.java       18 Mar 2005 22:02:09 -0000      1.10
  @@ -17,7 +17,7 @@
    */
   
   import org.apache.maven.artifact.Artifact;
  -import org.apache.maven.artifact.DefaultArtifact;
  +import org.apache.maven.artifact.construction.ArtifactConstructionSupport;
   import org.apache.maven.artifact.repository.ArtifactRepository;
   import org.apache.maven.model.Dependency;
   
  @@ -29,6 +29,7 @@
   // TODO: packaging is very confusing - this isn't in artifact after all
   
   public class DefaultArtifactFactory
  +    extends ArtifactConstructionSupport
       implements ArtifactFactory
   {
       public Set createArtifacts( List dependencies, ArtifactRepository 
localRepository, String inheritedScope )
  @@ -55,35 +56,4 @@
                                  dependency.getScope(), dependency.getType(), 
dependency.getType(), inheritedScope );
       }
   
  -    public Artifact createArtifact( String groupId, String artifactId, 
String version, String scope, String type,
  -                                    String extension, String inheritedScope )
  -    {
  -        // TODO: can refactor, use scope handler
  -
  -        // if this artifact is test, and the dependency is test, don't 
transitively create
  -        if ( Artifact.SCOPE_TEST.equals( inheritedScope ) && 
Artifact.SCOPE_TEST.equals( scope ) )
  -        {
  -            return null;
  -        }
  -
  -        // TODO: localRepository not used (should be used here to resolve 
path?
  -        String desiredScope = Artifact.SCOPE_RUNTIME;
  -        if ( Artifact.SCOPE_COMPILE.equals( scope ) && inheritedScope == 
null )
  -        {
  -            desiredScope = Artifact.SCOPE_COMPILE;
  -        }
  -
  -        // vvv added to retain compile scope. Remove if you want compile 
inherited as runtime
  -        else if ( Artifact.SCOPE_COMPILE.equals( scope ) && 
Artifact.SCOPE_COMPILE.equals( inheritedScope ) )
  -        {
  -            desiredScope = Artifact.SCOPE_COMPILE;
  -        }
  -        // ^^^ added to retain compile scope. Remove if you want compile 
inherited as runtime
  -
  -        if ( Artifact.SCOPE_TEST.equals( scope ) || 
Artifact.SCOPE_TEST.equals( inheritedScope ) )
  -        {
  -            desiredScope = Artifact.SCOPE_TEST;
  -        }
  -        return new DefaultArtifact( groupId, artifactId, version, 
desiredScope, type, extension );
  -    }
   }
  
  
  
  1.39      +2 -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.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- DefaultMaven.java 16 Mar 2005 23:19:00 -0000      1.38
  +++ DefaultMaven.java 18 Mar 2005 22:02:09 -0000      1.39
  @@ -101,7 +101,7 @@
   
                   if ( projects.isEmpty() )
                   {
  -                    projects.add( projectBuilder.buildSuperProject( 
request.getLocalRepository() ) );
  +                    projects.add( 
projectBuilder.buildStandaloneSuperProject( request.getLocalRepository() ) );
                   }
               }
               catch ( IOException e )
  
  
  

Reply via email to