You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cc...@apache.org on 2010/05/16 08:39:34 UTC
svn commit: r944768 - in /felix/trunk/karaf/tooling/features-maven-plugin:
pom.xml
src/main/java/org/apache/felix/karaf/tooling/features/AddFeaturesToRepoMojo.java
Author: ccustine
Date: Sun May 16 06:39:34 2010
New Revision: 944768
URL: http://svn.apache.org/viewvc?rev=944768&view=rev
Log:
FELIX-2343 - Features maven plugin does not honor local and remote repository overrides
Modified:
felix/trunk/karaf/tooling/features-maven-plugin/pom.xml
felix/trunk/karaf/tooling/features-maven-plugin/src/main/java/org/apache/felix/karaf/tooling/features/AddFeaturesToRepoMojo.java
Modified: felix/trunk/karaf/tooling/features-maven-plugin/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/tooling/features-maven-plugin/pom.xml?rev=944768&r1=944767&r2=944768&view=diff
==============================================================================
--- felix/trunk/karaf/tooling/features-maven-plugin/pom.xml (original)
+++ felix/trunk/karaf/tooling/features-maven-plugin/pom.xml Sun May 16 06:39:34 2010
@@ -56,10 +56,6 @@
<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>
Modified: felix/trunk/karaf/tooling/features-maven-plugin/src/main/java/org/apache/felix/karaf/tooling/features/AddFeaturesToRepoMojo.java
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/tooling/features-maven-plugin/src/main/java/org/apache/felix/karaf/tooling/features/AddFeaturesToRepoMojo.java?rev=944768&r1=944767&r2=944768&view=diff
==============================================================================
--- felix/trunk/karaf/tooling/features-maven-plugin/src/main/java/org/apache/felix/karaf/tooling/features/AddFeaturesToRepoMojo.java (original)
+++ felix/trunk/karaf/tooling/features-maven-plugin/src/main/java/org/apache/felix/karaf/tooling/features/AddFeaturesToRepoMojo.java Sun May 16 06:39:34 2010
@@ -33,20 +33,17 @@ import java.io.BufferedOutputStream;
import java.io.FileOutputStream;
import java.io.FileInputStream;
import java.net.URI;
-import java.net.URL;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
+import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
+import org.apache.maven.artifact.resolver.ArtifactResolutionException;
import org.w3c.dom.*;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.artifact.Artifact;
-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;
/**
@@ -92,7 +89,7 @@ public class AddFeaturesToRepoMojo exten
for (String feature : transitiveFeatures) {
bundles.addAll(featuresMap.get(feature).getBundles());
}
- System.out.println("Base repo: " + localRepo.getUrl());
+ getLog().info("Base repo: " + localRepo.getUrl());
for (String bundle : bundles) {
if (bundle.startsWith("wrap:")) {
bundle = bundle.substring(5);
@@ -118,12 +115,24 @@ public class AddFeaturesToRepoMojo exten
}
String dir = groupId.replace('.', '/') + "/" + artifactId + "/" + version + "/";
String name = artifactId + "-" + version + (classifier != null ? "-" + classifier : "") + "." + type;
- System.out.println("Copy: " + bundle);
- copy(new URL(null, bundle, new Handler()).openStream(),
- repository,
- name,
- dir,
- new byte[8192]);
+
+ Artifact artifact;
+ try {
+ artifact = this.factory.createArtifact(groupId, artifactId, version,
+ (classifier != null ? classifier : ""), type);
+ getLog().info("Copying bundle: " + bundle);
+ resolver.resolve(artifact, this.remoteRepos, this.localRepo);
+ copy(new FileInputStream(artifact.getFile()),
+ repository,
+ name,
+ dir,
+ new byte[8192]);
+ } catch (ArtifactResolutionException e) {
+ getLog().error("Can't resolve bundle " + bundle, e);
+ } catch (ArtifactNotFoundException e) {
+ getLog().error("Can't resolve bundle " + bundle, e);
+ }
+
}
} catch (MojoExecutionException e) {