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 2024/03/13 16:29:07 UTC

(camel) 05/06: CAMEL-18090: camel-main - Loading properties with profiles for prod/dev/test

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

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

commit dedea474ab9b64a857760448254453bb0ae7055d
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Mar 13 17:00:25 2024 +0100

    CAMEL-18090: camel-main - Loading properties with profiles for prod/dev/test
---
 docs/user-manual/modules/ROOT/pages/camel-maven-plugin.adoc            | 2 ++
 tooling/maven/camel-maven-plugin/src/main/docs/camel-maven-plugin.adoc | 1 +
 .../src/main/java/org/apache/camel/maven/DevMojo.java                  | 3 ++-
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/docs/user-manual/modules/ROOT/pages/camel-maven-plugin.adoc b/docs/user-manual/modules/ROOT/pages/camel-maven-plugin.adoc
index a2b0ab8fa7b..0c0284b0d0c 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-maven-plugin.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-maven-plugin.adoc
@@ -36,6 +36,7 @@ The maven plugin *run* goal supports the following options which can be configur
 | durationMaxMessages | -1 | Sets the duration of maximum number of messages that the application will process before terminating.
 | logClasspath | false | Whether to log the classpath when starting
 | loggingLevel | OFF | Whether to use built-in console logging (uses log4j), which does not require to add any logging dependency to your project. However, the logging is fixed to log to the console, with a color style that is similar to Spring Boot. You can change the root logging level to: FATAL, ERROR, WARN, INFO, DEBUG, TRACE, OFF
+| profile |  | To run with a specific Camel Main profile (dev,test,prod)
 |===
 
 
@@ -96,6 +97,7 @@ The maven plugin *dev* goal supports the following options which can be configur
 | durationMaxMessages | -1 | Sets the duration of maximum number of messages that the application will process before terminating.
 | logClasspath | false | Whether to log the classpath when starting
 | loggingLevel | OFF | Whether to use built-in console logging (uses log4j), which does not require to add any logging dependency to your project. However, the logging is fixed to log to the console, with a color style that is similar to Spring Boot. You can change the root logging level to: FATAL, ERROR, WARN, INFO, DEBUG, TRACE, OFF
+| profile | dev | To run with a specific Camel Main profile (dev,test,prod)
 |===
 
 == camel:debug
diff --git a/tooling/maven/camel-maven-plugin/src/main/docs/camel-maven-plugin.adoc b/tooling/maven/camel-maven-plugin/src/main/docs/camel-maven-plugin.adoc
index 07692fd818d..0c0284b0d0c 100644
--- a/tooling/maven/camel-maven-plugin/src/main/docs/camel-maven-plugin.adoc
+++ b/tooling/maven/camel-maven-plugin/src/main/docs/camel-maven-plugin.adoc
@@ -97,6 +97,7 @@ The maven plugin *dev* goal supports the following options which can be configur
 | durationMaxMessages | -1 | Sets the duration of maximum number of messages that the application will process before terminating.
 | logClasspath | false | Whether to log the classpath when starting
 | loggingLevel | OFF | Whether to use built-in console logging (uses log4j), which does not require to add any logging dependency to your project. However, the logging is fixed to log to the console, with a color style that is similar to Spring Boot. You can change the root logging level to: FATAL, ERROR, WARN, INFO, DEBUG, TRACE, OFF
+| profile | dev | To run with a specific Camel Main profile (dev,test,prod)
 |===
 
 == camel:debug
diff --git a/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/DevMojo.java b/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/DevMojo.java
index 6d05ad46631..82d1dd18d65 100644
--- a/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/DevMojo.java
+++ b/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/DevMojo.java
@@ -50,7 +50,8 @@ public class DevMojo extends RunMojo {
         // use absolute path for dir
         dir = new File(dir).getAbsolutePath();
 
-        System.setProperty("camel.main.profile", "dev");
+        // use dev profile by default
+        System.setProperty("camel.main.profile", profile == null ? "dev" : profile);
         System.setProperty("camel.main.routesReloadEnabled", "true");
         System.setProperty("camel.main.routesReloadDirectory", dir);
         System.setProperty("camel.main.routesReloadDirectoryRecursive", "true");