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

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


The following commit(s) were added to refs/heads/camel-4.0.x by this push:
     new 8b4f28ac43e CAMEL-19895 - Fix to respect absolute path for output 
directory for (#11504)
8b4f28ac43e is described below

commit 8b4f28ac43eac14417447b0efc3572dd495c3b30
Author: AurĂ©lien Pupier <[email protected]>
AuthorDate: Thu Sep 21 10:43:17 2023 +0200

    CAMEL-19895 - Fix to respect absolute path for output directory for (#11504)
    
    `camel dependency copy` command
    
    Signed-off-by: AurĂ©lien Pupier <[email protected]>
---
 .../apache/camel/dsl/jbang/core/commands/DependencyCopy.java | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/DependencyCopy.java
 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/DependencyCopy.java
index 02cfde7a9b1..b60a6c44132 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/DependencyCopy.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/DependencyCopy.java
@@ -17,6 +17,8 @@
 package org.apache.camel.dsl.jbang.core.commands;
 
 import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Paths;
 import java.util.Properties;
 import java.util.concurrent.TimeUnit;
 
@@ -50,9 +52,15 @@ public class DependencyCopy extends Export {
         Integer answer = doExport();
         if (answer == 0) {
             File buildDir = new File(EXPORT_DIR);
+            String outputDirectoryParameter = "-DoutputDirectory=";
+            if (Paths.get(outputDirectory).isAbsolute()) {
+                outputDirectoryParameter += outputDirectory;
+            } else {
+                outputDirectoryParameter += "../../" + outputDirectory;
+            }
             Process p = Runtime.getRuntime()
-                    .exec("mvn dependency:copy-dependencies 
-DincludeScope=compile 
-DexcludeGroupIds=org.fusesource.jansi,org.apache.logging.log4j 
-DoutputDirectory=../../"
-                          + outputDirectory,
+                    .exec("mvn dependency:copy-dependencies 
-DincludeScope=compile 
-DexcludeGroupIds=org.fusesource.jansi,org.apache.logging.log4j "
+                          + outputDirectoryParameter,
                             null,
                             buildDir);
             boolean done = p.waitFor(60, TimeUnit.SECONDS);

Reply via email to