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

commit 9d4730927c0ad1e6141bd79f9df2c519939b5b47
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Sun Jan 8 20:27:39 2023 +0100

    CAMEL-18497: camel-jbang - Run command now supports specifying a different 
Camel version.
---
 .../src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

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 517dfb1a4ef..1a96662cc14 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
@@ -49,6 +49,8 @@ import com.fasterxml.jackson.databind.ObjectMapper;
 import io.apicurio.datamodels.Library;
 import io.apicurio.datamodels.openapi.models.OasDocument;
 import org.apache.camel.CamelContext;
+import org.apache.camel.catalog.CamelCatalog;
+import org.apache.camel.catalog.DefaultCamelCatalog;
 import org.apache.camel.dsl.jbang.core.common.RuntimeUtil;
 import org.apache.camel.generator.openapi.RestDslGenerator;
 import org.apache.camel.impl.lw.LightweightCamelContext;
@@ -360,7 +362,8 @@ class Run extends CamelCommand {
         writeSetting(main, profileProperties, "camel.jbang.repos", repos);
         writeSetting(main, profileProperties, "camel.jbang.health", health ? 
"true" : "false");
         writeSetting(main, profileProperties, "camel.jbang.console", console ? 
"true" : "false");
-        writeSetting(main, profileProperties, 
"camel.main.routesCompileDirectory", WORK_DIR);
+        // the runtime version of Camel is what is loaded via the catalog
+        writeSetting(main, profileProperties, "camel.jbang.camel-version", new 
DefaultCamelCatalog().getCatalogVersion());
         // merge existing dependencies with --deps
         String deps = RuntimeUtil.getDependencies(profileProperties);
         if (deps.isBlank()) {
@@ -610,7 +613,6 @@ class Run extends CamelCommand {
                                + ") in background with PID: " + p.pid());
             return 0;
         } else {
-            // TODO: this makes camel CLI confused: camel get
             pb.inheritIO(); // run in foreground (with IO so logs are visible)
             Process p = pb.start();
             // wait for that process to exit as we run in foreground

Reply via email to