felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r945101 - /felix/trunk/karaf/tooling/features-maven-plugin/src/main/java/org/apache/felix/karaf/tooling/features/AddFeaturesToRepoMojo.java
Date Mon, 17 May 2010 11:53:08 GMT
Author: gnodet
Date: Mon May 17 11:53:07 2010
New Revision: 945101

URL: http://svn.apache.org/viewvc?rev=945101&view=rev
Log:
FELIX-2329: Improve the URL handling  in features-maven-plugin regarding the add-features-to-repo
goal

Modified:
    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/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=945101&r1=945100&r2=945101&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
Mon May 17 11:53:07 2010
@@ -74,6 +74,11 @@ public class AddFeaturesToRepoMojo exten
      */
     private File repository;
 
+    /**
+     * @parameter
+     */
+    private boolean skipNonMavenProtocols = true;
+
     public void execute() throws MojoExecutionException, MojoFailureException {
         try {
             Map<String, Feature> featuresMap = new HashMap<String, Feature>();
@@ -91,12 +96,32 @@ public class AddFeaturesToRepoMojo exten
             }
             getLog().info("Base repo: " + localRepo.getUrl());
             for (String bundle : bundles) {
-                if (bundle.startsWith("wrap:")) {
-                    bundle = bundle.substring(5);
-                }
-                if (!bundle.startsWith("mvn:")) {
+                final int index = bundle.indexOf("mvn:");
+                if (index < 0) {
+                    if (skipNonMavenProtocols) {
+                        continue;
+                    }
                     throw new MojoExecutionException("Bundle url is not a maven url: " +
bundle);
                 }
+                else {
+                    bundle = bundle.substring(index);
+                }
+                // Truncate the URL when a '#' or a '?' is encountered
+                final int index1 = bundle.indexOf('?');
+                final int index2 = bundle.indexOf('#');
+                int endIndex = -1;
+                if (index1 > 0) {
+                     if (index2 > 0) {
+                         endIndex = Math.min(index1, index2);
+                     } else {
+                         endIndex = index1;
+                     }
+                } else if (index2 > 0) {
+                    endIndex = index2;
+                }
+                if (endIndex >= 0) {
+                    bundle = bundle.substring(0, endIndex);
+                }
                               
                 String[] parts = bundle.substring("mvn:".length()).split("/");
                 String groupId = parts[0];



Mime
View raw message