/*-
 * Copyright (c) 2012-2013 Red Hat, Inc.
 *
 * 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.
 */
package org.fedoraproject.maven.resolver;

import java.io.File;

import org.fedoraproject.maven.config.ResolverSettings;
import org.fedoraproject.maven.model.Artifact;
import org.fedoraproject.maven.repository.Layout;
import org.fedoraproject.maven.repository.Repository;
import org.fedoraproject.maven.repository.SingletonRepository;

class LocalResolver
    extends AbstractResolver
{
    private final Repository repo;

    public LocalResolver( ResolverSettings settings )
    {
        // FIXME: only the first local repository is used for now
        if ( settings.getLocalRepositories().size() > 0 )
        {
            String localRepoDir = settings.getLocalRepositories().iterator().next();
            repo = new SingletonRepository( new File( localRepoDir ), Layout.MAVEN );
        }
        else
        {
            repo = null;
        }
    }

    @Override
    public File resolve( Artifact artifact )
    {
        if ( repo != null )
        {
            return repo.findArtifact( artifact, true );
        }
        else
        {
            return null;
        }
    }
}

@@ -663,16 +663,68 @@
 io.File;
+%0Aimport java.util.LinkedList;%0Aimport java.util.List;
 %0A%0Aimport
@@ -1057,16 +1057,21 @@
 e final 
+List%3C
 Reposito
@@ -1072,21 +1072,51 @@
 pository
+%3E
  repo
+sitories = new LinkedList%3C%3E()
 ;%0A%0A    p
@@ -1182,78 +1182,35 @@
     
-// FIXME: only the first
+for ( String
  local
- repository is used for now%0A        if (
+RepoDir :
  set
@@ -1241,19 +1241,8 @@
 es()
-.size() %3E 0
  )%0A 
@@ -1266,92 +1266,18 @@
     
-String localRepoDir = settings.getLocalRepositories().iterator().next();%0A           
+Repository
  rep
@@ -1359,56 +1359,36 @@
     
-%7D%0A        else%0A        %7B%0A            repo = null
+    repositories.add( repo )
 ;%0A  
@@ -1479,25 +1479,44 @@
     
-if ( repo != null
+for ( Repository repo : repositories
  )%0A 
@@ -1536,22 +1536,35 @@
         
-return
+File artifactFile =
  repo.fi
@@ -1605,33 +1605,44 @@
     
-%7D%0A
     
-    else%0A    
+if ( artifactFile != null )%0A
     
-%7B%0A
     
@@ -1660,23 +1660,53 @@
 urn 
-null;%0A        %7D
+artifactFile;%0A        %7D%0A%0A        return null;
 %0A   

Use all local repositories to resolve artifacts, not just only one