[FELIX-2193] add-features-to-repo goal of features-maven-plugin should be able to download dependencies if necessary

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@923684 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/karaf/tooling/features-maven-plugin/pom.xml b/karaf/tooling/features-maven-plugin/pom.xml
index a4ee251..f72e3e7 100644
--- a/karaf/tooling/features-maven-plugin/pom.xml
+++ b/karaf/tooling/features-maven-plugin/pom.xml
@@ -56,6 +56,10 @@
         <artifactId>org.apache.felix.karaf.features.core</artifactId>
       </dependency>
       <dependency>
+        <groupId>org.ops4j.pax.url</groupId>
+        <artifactId>pax-url-mvn</artifactId>
+      </dependency>
+      <dependency>
         <groupId>org.easymock</groupId>
         <artifactId>easymock</artifactId>
         <scope>test</scope>
diff --git a/karaf/tooling/features-maven-plugin/src/main/java/org/apache/felix/karaf/tooling/features/AddFeaturesToRepoMojo.java b/karaf/tooling/features-maven-plugin/src/main/java/org/apache/felix/karaf/tooling/features/AddFeaturesToRepoMojo.java
index 15dd08b..2a11324 100644
--- a/karaf/tooling/features-maven-plugin/src/main/java/org/apache/felix/karaf/tooling/features/AddFeaturesToRepoMojo.java
+++ b/karaf/tooling/features-maven-plugin/src/main/java/org/apache/felix/karaf/tooling/features/AddFeaturesToRepoMojo.java
@@ -46,6 +46,7 @@
 import org.apache.maven.artifact.DefaultArtifact;
 import org.apache.maven.artifact.handler.DefaultArtifactHandler;
 import org.apache.maven.artifact.versioning.VersionRange;
+import org.ops4j.pax.url.mvn.Handler;
 import org.xml.sax.SAXException;
 
 /**
@@ -99,6 +100,7 @@
                 if (!bundle.startsWith("mvn:")) {
                     throw new MojoExecutionException("Bundle url is not a maven url: " + bundle);
                 }
+                              
                 String[] parts = bundle.substring("mvn:".length()).split("/");
                 String groupId = parts[0];
                 String artifactId = parts[1];
@@ -116,8 +118,8 @@
                 }
                 String dir = groupId.replace('.', '/') + "/" + artifactId + "/" + version + "/";
                 String name = artifactId + "-" + version + (classifier != null ? "-" + classifier : "") + "." + type;
-                System.out.println("Copy:      " + dir + name);
-                copy(new URL(getLocalRepoUrl() + "/" + dir + name).openStream(),
+                System.out.println("Copy:      " + bundle);
+                copy(new URL(null, bundle, new Handler()).openStream(),
                      repository,
                      name,
                      dir,