Message:

   The following issue has been closed.

   Resolver: Peter Donald
       Date: Mon, 25 Aug 2003 3:39 AM

Seems to be fixed in latest CVS
---------------------------------------------------------------------
View the issue:

  http://jira.codehaus.org/secure/ViewIssue.jspa?key=MAVEN-718


Here is an overview of the issue:
---------------------------------------------------------------------
        Key: MAVEN-718
    Summary: Additional remote repositories ignored
       Type: Bug

     Status: Closed
   Priority: Major
 Resolution: FIXED

 Time Spent: Unknown
  Remaining: 0 minutes

    Project: maven

   Assignee: james strachan
   Reporter: 

    Created: Sun, 2 Feb 2003 3:16 PM
    Updated: Mon, 25 Aug 2003 3:39 AM

Description:
I'm using MAVEN HEAD from 2/1/03. I've overridden the remote repo property as the 
following 
maven.repo.remote=http://somerepo/maven,http://www.ibiblio.org/maven. The problem 
arises when Maven tries to retrieve a project dependency that is in one, but not both, 
of the remote repos. If an artifact doesn't exist in a remote repo, then a 
FileNotFoundException is thrown (it seems from HttpURLConnection.getResponseCode() in 
HttpUtils.java). The FileNotFoundException is caught in 
DependencyVerifier.getRemoteArtifact(Artifact) and returns false, which exits the 
loop. So additional remote repos are not checked or if the artifact was found in a 
previous remote repo in the list then returning false erronously reports the 
dependency as failed. I tested with the touchstone build by adding a test jar c.jar to 
the project dependencies, uploaded c.jar to http://somerepo/maven, and set 
maven.repo.remote=http://somerepo/maven,http://www.ibiblio.org/maven in 
project.properties. I ran maven:jar-install and the build failed due to the 
unsatisfied dependency. I then applied the patch below to DependencyVerifier and ran 
the same test and it worked correctly. 

Index: DependencyVerifier.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-turbine-maven/src/java/org/apache/maven/verifier/DependencyVerifier.java,v
retrieving revision 1.15
diff -u -r1.15 DependencyVerifier.java
--- DependencyVerifier.java     31 Jan 2003 17:15:05 -0000      1.15
+++ DependencyVerifier.java     2 Feb 2003 20:16:48 -0000
@@ -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;
@@ -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 )
             {



---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to