maven-m2-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tryg...@apache.org
Subject cvs commit: maven-components/maven-core/src/main/java/org/apache/maven/artifact MavenMetadataSource.java
Date Thu, 07 Oct 2004 10:00:55 GMT
trygvis     2004/10/07 03:00:55

  Modified:    maven-core/src/main/java/org/apache/maven/artifact
                        MavenMetadataSource.java
  Log:
  o Better error reporting.
  
  Revision  Changes    Path
  1.4       +18 -13    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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- MavenMetadataSource.java	12 Aug 2004 17:55:47 -0000	1.3
  +++ MavenMetadataSource.java	7 Oct 2004 10:00:55 -0000	1.4
  @@ -1,19 +1,20 @@
   package org.apache.maven.artifact;
   
  +import java.io.FileReader;
  +import java.util.HashSet;
  +import java.util.Iterator;
  +import java.util.List;
  +import java.util.Set;
  +
   import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
   import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
   import org.apache.maven.artifact.repository.ArtifactRepository;
  +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 java.io.FileReader;
  -import java.util.HashSet;
  -import java.util.Iterator;
  -import java.util.List;
  -import java.util.Set;
  -
   /*
    * Copyright 2001-2004 The Apache Software Foundation.
    *
  @@ -61,22 +62,26 @@
       {
           Set artifacts;
   
  +        Artifact metadataArtifact = new DefaultArtifact( artifact.getGroupId(),
  +                                                         artifact.getArtifactId(),
  +                                                         artifact.getVersion(),
  +                                                         "pom" );
  +
           try
           {
  -            Artifact metadataArtifact = new DefaultArtifact( artifact.getGroupId(),
  -                                                             artifact.getArtifactId(),
  -                                                             artifact.getVersion(),
  -                                                             "pom" );
  -
               artifactResolver.resolve( metadataArtifact, remoteRepositories, localRepository
);
   
               Model model = reader.read( new FileReader( metadataArtifact.getFile() ) );
   
               artifacts = createArtifacts( model.getDependencies(), localRepository );
           }
  +        catch ( ArtifactResolutionException e )
  +        {
  +            throw new ArtifactMetadataRetrievalException( "Error while resolving metadata
artifact", e );
  +        }
           catch ( Exception e )
           {
  -            throw new ArtifactMetadataRetrievalException( "Cannot read artifact source:
", e );
  +            throw new ArtifactMetadataRetrievalException( "Cannot read artifact source:
" + metadataArtifact.getFile(), e );
           }
   
           return artifacts;
  
  
  

Mime
View raw message