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 2023/09/21 08:50:46 UTC

[camel] branch camel-3.x updated: CAMEL-19895 - Fix to respect absolute path for output directory for (#11505)

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

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


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

commit c3573ae4bfa93e43b6068840242e6970245322bf
Author: Aurélien Pupier <ap...@redhat.com>
AuthorDate: Thu Sep 21 10:50:39 2023 +0200

    CAMEL-19895 - Fix to respect absolute path for output directory for (#11505)
    
    `camel dependency copy` command
    
    Signed-off-by: Aurélien Pupier <ap...@redhat.com>
---
 .../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);