You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2022/05/17 05:22:36 UTC

[camel] branch main updated: CAMEL-18117: camel-jbang - uberjar should include files from loaded settings that may not have leading scheme

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 8f1c0a340a7 CAMEL-18117: camel-jbang - uberjar should include files from loaded settings that may not have leading scheme
8f1c0a340a7 is described below

commit 8f1c0a340a78076b59372b36169d3516bb42ce4d
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue May 17 07:06:34 2022 +0200

    CAMEL-18117: camel-jbang - uberjar should include files from loaded settings that may not have leading scheme
---
 .../camel/dsl/jbang/core/commands/UberJar.java     | 23 ++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/UberJar.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/UberJar.java
index f0df47cfa39..01e1efb17c1 100644
--- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/UberJar.java
+++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/UberJar.java
@@ -57,7 +57,8 @@ class UberJar implements Callable<Integer> {
     private static final String[] SETTINGS_PROP_SOURCE_KEYS = new String[] {
             "camel.main.routesIncludePattern",
             "camel.component.properties.location",
-            "camel.component.kamelet.location"
+            "camel.component.kamelet.location",
+            "camel.jbang.classpathFiles"
     };
 
     //CHECKSTYLE:OFF
@@ -316,12 +317,13 @@ class UberJar implements Callable<Integer> {
             String files = prop.getProperty(k);
             if (files != null) {
                 for (String f : files.split(",")) {
-                    if (f.startsWith("file:")) {
-                        f = f.substring(5);
-                        File source = new File(f);
-                        File out = new File(target, source.getName());
-                        safeCopy(source, out, true);
+                    String scheme = getScheme(f);
+                    if (scheme != null) {
+                        f = f.substring(scheme.length() + 1);
                     }
+                    File source = new File(f);
+                    File out = new File(target, source.getName());
+                    safeCopy(source, out, true);
                 }
             }
         }
@@ -372,4 +374,13 @@ class UberJar implements Callable<Integer> {
         }
     }
 
+    private static String getScheme(String name) {
+        int pos = name.indexOf(":");
+        if (pos != -1) {
+            return name.substring(0, pos);
+        }
+        return null;
+    }
+
+
 }