Index: AddFeaturesToRepoMojo.java
===================================================================
--- AddFeaturesToRepoMojo.java	(revision 1059407)
+++ AddFeaturesToRepoMojo.java	(working copy)
@@ -17,6 +17,21 @@
  */
 package org.apache.karaf.tooling.features;
 
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.DefaultArtifactRepository;
+import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
+import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
+import org.apache.maven.artifact.resolver.ArtifactResolutionException;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
 import java.io.BufferedOutputStream;
 import java.io.ByteArrayInputStream;
 import java.io.File;
@@ -26,6 +41,7 @@
 import java.io.InputStream;
 import java.net.URI;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Hashtable;
@@ -33,20 +49,8 @@
 import java.util.Map;
 import java.util.Properties;
 import java.util.Set;
+import java.util.UUID;
 
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
-import org.apache.maven.artifact.resolver.ArtifactResolutionException;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-import org.xml.sax.SAXException;
-
 /**
  * Generates the features XML file
  *
@@ -113,6 +117,10 @@
                     featuresMap.put(f.getName(), f);
                 }
             }
+            // no features specified, handle all of them
+            if(features == null) {
+                features = new ArrayList<String>(featuresMap.keySet());
+            }
             Set<String> featuresBundles = new HashSet<String>();
             Set<String> transitiveFeatures = new HashSet<String>();
             addFeatures(features, featuresBundles, transitiveFeatures, featuresMap);
@@ -131,6 +139,9 @@
                 }
             }
 
+            // bundles with explicitely specified remote repos. key -> bundle, value -> remote repo
+            Map<String, ArtifactRepository> explicitRepoBundles = new HashMap<String, ArtifactRepository>();
+
             getLog().info("Base repo: " + localRepo.getUrl());
             for (String bundle : bundles) {
                 // get rid of of possible line-breaks KARAF-313
@@ -166,46 +177,27 @@
                 	bundle = bundle.substring(0, index3);
                 }
 
-                String[] parts = bundle.substring("mvn:".length()).split("/");
-                String groupId = parts[0];
-                String artifactId = parts[1];
-                String version = null;
-                String classifier = null;
-                String type = "jar";
-                if (parts.length > 2) {
-                    version = parts[2];
-                    if (parts.length > 3) {
-                        type = parts[3];
-                        if (parts.length > 4) {
-                            classifier = parts[4];
-                        }
-                    }
+                String bundleDescriptor = bundle.substring("mvn:".length());
+                if(bundleDescriptor.startsWith("http://")) {
+                    final int repoDelimIntex = bundleDescriptor.indexOf('!');
+                    String repoUrl = bundleDescriptor.substring(0, repoDelimIntex);
+
+                    ArtifactRepository repo = new DefaultArtifactRepository(
+                            repoUrl,
+                            repoUrl,
+                            new DefaultRepositoryLayout());
+                    bundleDescriptor = bundleDescriptor.substring(repoDelimIntex + 1);
+
+                    explicitRepoBundles.put(bundleDescriptor, repo);
+                    continue;
                 }
-                String dir = groupId.replace('.', '/') + "/" + artifactId + "/" + version + "/";
-                String name = artifactId + "-" + version + (classifier != null ? "-" + classifier : "") + "." + type;
 
-                Artifact artifact;
-                try {
-                    artifact = factory.createArtifactWithClassifier(groupId, artifactId, version, type, classifier);
-                    getLog().info("Copying bundle: " + bundle);
-                    resolver.resolve(artifact, remoteRepos, localRepo);
-                    copy(new FileInputStream(artifact.getFile()),
-                         repository,
-                         name,
-                         dir,
-                         new byte[8192]);
-                } catch (ArtifactResolutionException e) {
-                    if (failOnArtifactResolutionError) {
-                        throw new MojoFailureException("Can't resolve bundle " + bundle, e);
-                    }
-                    getLog().error("Can't resolve bundle " + bundle, e);
-                } catch (ArtifactNotFoundException e) {
-                    if (failOnArtifactResolutionError) {
-                        throw new MojoFailureException("Can't resolve bundle " + bundle, e);
-                    }
-                    getLog().error("Can't resolve bundle " + bundle, e);
-                }
+                resolveBundle(bundleDescriptor, remoteRepos);
             }
+            // resolving all bundles with explicitely specified remote repository
+            for(Map.Entry<String, ArtifactRepository> explicitBundle : explicitRepoBundles.entrySet()) {
+                resolveBundle(explicitBundle.getKey(), Collections.singletonList(explicitBundle.getValue()));
+            }
             if (copyFileBasedDescriptors != null) {
                 for (CopyFileBasedDescriptor fileBasedDescritpor : copyFileBasedDescriptors) {
                     copy(new FileInputStream(fileBasedDescritpor.getSourceFile()),
@@ -224,6 +216,47 @@
         }
     }
 
+    private void resolveBundle(String bundle, List<ArtifactRepository> remoteRepos) throws IOException, MojoFailureException {
+        String[] parts = bundle.split("/");
+        String groupId = parts[0];
+        String artifactId = parts[1];
+        String version = null;
+        String classifier = null;
+        String type = "jar";
+        if (parts.length > 2) {
+            version = parts[2];
+            if (parts.length > 3) {
+                type = parts[3];
+                if (parts.length > 4) {
+                    classifier = parts[4];
+                }
+            }
+        }
+        String dir = groupId.replace('.', '/') + "/" + artifactId + "/" + version + "/";
+        String name = artifactId + "-" + version + (classifier != null ? "-" + classifier : "") + "." + type;
+
+        Artifact artifact = factory.createArtifactWithClassifier(groupId, artifactId, version, type, classifier);
+        try {
+            getLog().info("Copying bundle: " + bundle);
+            resolver.resolve(artifact, remoteRepos, localRepo);
+            copy(new FileInputStream(artifact.getFile()),
+                 repository,
+                 name,
+                 dir,
+                 new byte[8192]);
+        } catch (ArtifactResolutionException e) {
+            if (failOnArtifactResolutionError) {
+                throw new MojoFailureException("Can't resolve bundle " + bundle, e);
+            }
+            getLog().error("Can't resolve bundle " + bundle, e);
+        } catch (ArtifactNotFoundException e) {
+            if (failOnArtifactResolutionError) {
+                throw new MojoFailureException("Can't resolve bundle " + bundle, e);
+            }
+            getLog().error("Can't resolve bundle " + bundle, e);
+        }
+    }
+
     private void addFeatures(List<String> features, Set<String> featuresBundles, Set<String> transitiveFeatures, Map<String, Feature> featuresMap) {
         for (String feature : features) {
             Feature f = featuresMap.get(feature);
