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/10/04 14:45:43 UTC

[camel] branch port created (now ac6db97a673)

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

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


      at ac6db97a673 CAMEL-19949: camel-jbang - Add --jvm-debug-port option

This branch includes the following new commits:

     new ac6db97a673 CAMEL-19949: camel-jbang - Add --jvm-debug-port option

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[camel] 01/01: CAMEL-19949: camel-jbang - Add --jvm-debug-port option

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit ac6db97a6735d754171a7518eb2001ab5824da81
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Oct 4 16:45:30 2023 +0200

    CAMEL-19949: camel-jbang - Add --jvm-debug-port option
---
 .../apache/camel/dsl/jbang/core/commands/Run.java    | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java
index ad0e0856925..18b159c790a 100644
--- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java
+++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java
@@ -169,6 +169,9 @@ public class Run extends CamelCommand {
     @Option(names = { "--jvm-debug" }, defaultValue = "false", description = "To enable JVM remote debug on localhost:4004")
     boolean jvmDebug;
 
+    @Option(names = { "--jvm-debug-port" }, description = "JVM remote debug port (default is 4004)")
+    int jvmDebugPort;
+
     @Option(names = { "--name" }, defaultValue = "CamelJBang", description = "The name of the Camel application")
     String name;
 
@@ -795,6 +798,7 @@ public class Run extends CamelCommand {
             download = "true".equals(answer.getProperty("camel.jbang.download", download ? "true" : "false"));
             background = "true".equals(answer.getProperty("camel.jbang.background", background ? "true" : "false"));
             jvmDebug = "true".equals(answer.getProperty("camel.jbang.jvmDebug", jvmDebug ? "true" : "false"));
+            jvmDebugPort = Integer.parseInt(answer.getProperty("camel.jbang.jvmDebugPort", String.valueOf(jvmDebugPort)));
             camelVersion = answer.getProperty("camel.jbang.camel-version", camelVersion);
             kameletsVersion = answer.getProperty("camel.jbang.kameletsVersion", kameletsVersion);
             gav = answer.getProperty("camel.jbang.gav", gav);
@@ -832,8 +836,13 @@ public class Run extends CamelCommand {
             jbangArgs.add("-Dcamel-kamelets.version=" + kameletsVersion);
         }
         if (jvmDebug) {
-            jbangArgs.add("--debug"); // jbang --debug
+            if (jvmDebugPort > 0) {
+                jbangArgs.add("--debug=" + jvmDebugPort); // jbang --debug=port
+            } else {
+                jbangArgs.add("--debug"); // jbang --debug
+            }
             cmds.remove("--jvm-debug");
+            cmds.removeIf(s -> s.startsWith("--jvm-debug-port"));
         }
 
         if (repos != null) {
@@ -842,6 +851,9 @@ public class Run extends CamelCommand {
         jbangArgs.add("camel@apache/camel");
         jbangArgs.addAll(cmds);
 
+        if (verbose) {
+            System.out.println(jbangArgs);
+        }
         ProcessBuilder pb = new ProcessBuilder();
         pb.command(jbangArgs);
         if (background) {
@@ -865,6 +877,9 @@ public class Run extends CamelCommand {
 
         cmds.add(0, "camel");
 
+        if (verbose) {
+            System.out.println(cmds);
+        }
         ProcessBuilder pb = new ProcessBuilder();
         pb.command(cmds);
         Process p = pb.start();
@@ -934,6 +949,9 @@ public class Run extends CamelCommand {
 
         jbangArgs.addAll(cmds);
 
+        if (verbose) {
+            System.out.println(jbangArgs);
+        }
         ProcessBuilder pb = new ProcessBuilder();
         pb.command(jbangArgs);
         if (background) {