maven-m2-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject cvs commit: maven-components/maven-core/src/main/java/org/apache/maven/artifact MavenMetadataSource.java
Date Tue, 15 Feb 2005 21:39:07 GMT
brett       2005/02/15 13:39:07

  Modified:    maven-core/src/main/java/org/apache/maven/artifact
                        MavenMetadataSource.java
  Log:
  need to reinstate the non-project builder version for plexus-runtime-builder
  
  Revision  Changes    Path
  1.10      +25 -5     maven-components/maven-core/src/main/java/org/apache/maven/artifact/MavenMetadataSource.java
  
  Index: MavenMetadataSource.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/artifact/MavenMetadataSource.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- MavenMetadataSource.java	8 Feb 2005 04:12:57 -0000	1.9
  +++ MavenMetadataSource.java	15 Feb 2005 21:39:07 -0000	1.10
  @@ -23,9 +23,12 @@
   import org.apache.maven.artifact.resolver.ArtifactResolutionException;
   import org.apache.maven.artifact.resolver.ArtifactResolver;
   import org.apache.maven.model.Dependency;
  +import org.apache.maven.model.Model;
  +import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
   import org.apache.maven.project.MavenProject;
   import org.apache.maven.project.MavenProjectBuilder;
   
  +import java.io.FileReader;
   import java.util.HashSet;
   import java.util.Iterator;
   import java.util.List;
  @@ -41,6 +44,17 @@
       private MavenProjectBuilder mavenProjectBuilder;
       private ArtifactResolver artifactResolver;
   
  +    /** @todo remove. */
  +    private MavenXpp3Reader reader = new MavenXpp3Reader();
  +
  +    public MavenMetadataSource( ArtifactResolver artifactResolver )
  +    {
  +        // there is code in plexus that uses this (though it shouldn't) so we
  +        // need to be able to not have a project builder
  +        this.artifactResolver = artifactResolver;
  +        this.mavenProjectBuilder = null;
  +    }
  +
       public MavenMetadataSource( ArtifactResolver artifactResolver, MavenProjectBuilder
projectBuilder )
       {
           this.artifactResolver = artifactResolver;
  @@ -62,10 +76,16 @@
               // [jdcasey/03-Feb-2005]: Replacing with ProjectBuilder, to enable
               // post-processing and inheritance calculation before retrieving the 
               // associated artifacts. This should improve consistency.
  -            MavenProject project = mavenProjectBuilder.build( metadataArtifact.getFile(),
localRepository );
  -            //            Model model = reader.read( new FileReader( metadataArtifact.getFile()
) );
  -
  -            artifacts = createArtifacts( project.getDependencies(), localRepository );
  +            if ( mavenProjectBuilder != null )
  +            {
  +                MavenProject project = mavenProjectBuilder.build( metadataArtifact.getFile(),
localRepository );
  +                artifacts = createArtifacts( project.getDependencies(), localRepository
);
  +            }
  +            else
  +            {
  +                Model model = reader.read( new FileReader( metadataArtifact.getFile() )
);
  +                artifacts = createArtifacts( model.getDependencies(), localRepository );
  +            }
           }
           catch ( ArtifactResolutionException e )
           {
  
  
  

Mime
View raw message