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 e52f56fba80 CAMEL-19895 - Fix to respect absolute path for output 
directory for (#11501)
e52f56fba80 is described below

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

    CAMEL-19895 - Fix to respect absolute path for output directory for (#11501)
    
    `camel dependency copy` command
    
    Signed-off-by: AurĂ©lien Pupier <[email protected]>
---
 .../apache/camel/dsl/jbang/core/commands/DependencyCopy.java  | 11 +++++++++--
 1 file changed, 9 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..6be4db2370d 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,7 @@
 package org.apache.camel.dsl.jbang.core.commands;
 
 import java.io.File;
+import java.nio.file.Paths;
 import java.util.Properties;
 import java.util.concurrent.TimeUnit;
 
@@ -50,9 +51,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