You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by jv...@apache.org on 2003/02/04 00:06:19 UTC

cvs commit: jakarta-turbine-maven/src/java/org/apache/maven/verifier DependencyVerifier.java

jvanzyl     2003/02/03 15:06:18

  Modified:    src/java/org/apache/maven/verifier DependencyVerifier.java
  Log:
  o Applying patch submitted by Darren Collins to fix the problem where
    additional remote repositories were being ignored.
  
  Revision  Changes    Path
  1.16      +22 -3     jakarta-turbine-maven/src/java/org/apache/maven/verifier/DependencyVerifier.java
  
  Index: DependencyVerifier.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/verifier/DependencyVerifier.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- DependencyVerifier.java	31 Jan 2003 17:15:05 -0000	1.15
  +++ DependencyVerifier.java	3 Feb 2003 23:06:18 -0000	1.16
  @@ -63,6 +63,7 @@
   import org.apache.maven.util.HttpUtils;
   
   import java.io.File;
  +import java.io.FileNotFoundException;
   import java.util.ArrayList;
   import java.util.Iterator;
   import java.util.List;
  @@ -192,7 +193,7 @@
   
           // If we have any failed dependencies then we will attempt to download
           // them for the user if the remote repository is enabled.
  -        if ( failedDependencies.isEmpty() == false
  +        if (   failedDependencies.isEmpty() == false
               && remoteRepoEnabled
               && online )
           {
  @@ -291,8 +292,10 @@
        */
       private boolean getRemoteArtifact( Artifact artifact )
       {
  +        boolean artifactFound = false;
  +
           for ( Iterator i = getProject().getContext().getMavenRepoRemote().iterator(); i.hasNext(); )
  -        {
  +        {            
               String remoteRepo = (String) i.next();
   
               // The username and password parameters are not being
  @@ -315,6 +318,22 @@
                                      getProject().getContext().getProxyUserName(),
                                      getProject().getContext().getProxyPassword(),
                                      true );
  +
  +                // Artifact was found, continue checking additional remote repos (if any)
  +                // in case there is a newer version (i.e. snapshots) in another repo  
  +                artifactFound = true;                                   
  +            }
  +            catch ( FileNotFoundException e )
  +            {
  +                // If there are additional remote repos, then ignore exception
  +                // as artifact may be found in another remote repo. If there
  +                // are no more remote repos to check and the artifact wasn't found in 
  +                // a previous remote repo, then return false indicating
  +                // that the artifact could not be found in any of the remote repos
  +                if ( !i.hasNext() && !artifactFound)
  +                {
  +                    return false;
  +                }                
               }
               catch ( Exception e )
               {