This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch CAMEL-28011-deprecate-modeline in repository https://gitbox.apache.org/repos/asf/camel.git
commit 40a013507f7a152e7abee647b0306d70c62126a0 Author: Claus Ibsen <[email protected]> AuthorDate: Tue Dec 1 23:16:16 2026 +0100 CAMEL-28011: Deprecate modeline (//DEPS lines in route files) Modeline makes the routes loader read every route file before loading it, to find //DEPS lines and download their dependencies. It is a relic from the Camel K era. The dependencies are declared in application.properties (camel.jbang.dependencies) or with camel run --dep instead. - @Deprecated on camel-dsl-modeline, camel.main.modeline, CamelContext.setModeline / isModeline and the ModelineFactory SPI; camel run --modeline says it is deprecated - a WARN is logged once for each route file with //DEPS lines - the MCP server instructions, the Java and Groovy check hints, the TUI CVE prompt and the docs point to application.properties and --dep - camel dependency list/update keep handling the //DEPS lines of JBang scripts - upgrade guide entry Behavior is unchanged; removal in a later release. Co-Authored-By: Claude Opus 5.5 <[email protected]> --- .../apache/camel/catalog/docs/dsl-modeline.adoc | 30 +++++++++++++++++++--- .../main/camel-main-configuration-metadata.json | 2 +- .../apache/camel/catalog/others/dsl-modeline.json | 2 +- .../main/java/org/apache/camel/CamelContext.java | 10 ++++++-- .../java/org/apache/camel/spi/ModelineFactory.java | 5 +++- .../camel-main-configuration-metadata.json | 2 +- .../camel/main/DefaultConfigurationProperties.java | 12 +++++++++ .../ROOT/pages/camel-4x-upgrade-guide-4_25.adoc | 15 +++++++++++ .../modules/ROOT/pages/camel-jbang-devtools.adoc | 4 +++ .../modules/ROOT/pages/camel-jbang-mcp.adoc | 4 +-- .../ROOT/pages/camel-jbang-tui-observe.adoc | 2 +- .../pages/jbang-commands/camel-jbang-debug.adoc | 2 +- .../ROOT/pages/jbang-commands/camel-jbang-dev.adoc | 2 +- .../ROOT/pages/jbang-commands/camel-jbang-run.adoc | 2 +- dsl/camel-dsl-modeline/pom.xml | 2 +- .../services/org/apache/camel/other.properties | 2 +- .../src/generated/resources/dsl-modeline.json | 2 +- .../src/main/docs/dsl-modeline.adoc | 30 +++++++++++++++++++--- .../camel/dsl/modeline/DefaultModelineFactory.java | 25 ++++++++++++++++++ .../camel/dsl/modeline/JBangModelineParser.java | 7 +++++ .../apache/camel/dsl/modeline/ModelineParser.java | 4 +++ .../META-INF/camel-jbang-commands-metadata.json | 6 ++--- .../apache/camel/dsl/jbang/core/commands/Run.java | 4 ++- .../jbang/core/commands/ai/GroovyImportChecks.java | 2 +- .../dsl/jbang/core/commands/ai/JavaChecks.java | 4 +-- .../src/test/resources/golden/cli-help.txt | 12 ++++++--- .../core/commands/mcp/McpServerInstructions.java | 7 ++--- .../commands/mcp/McpServerInstructionsTest.java | 2 +- .../dsl/jbang/core/commands/tui/CveAiPrompt.java | 2 +- .../jbang/core/commands/tui/CveAiPromptTest.java | 2 +- 30 files changed, 168 insertions(+), 39 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/dsl-modeline.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/dsl-modeline.adoc index b4fe310fe726..5a4fc95e8388 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/dsl-modeline.adoc +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/dsl-modeline.adoc @@ -1,17 +1,39 @@ -= DSL Modeline Component += DSL Modeline Component (deprecated) :doctitle: DSL Modeline :shortname: dsl-modeline :artifactid: camel-dsl-modeline :description: Camel DSL modeline :since: 3.16 -:supportlevel: Stable +:supportlevel: Stable-deprecated +:deprecated: *deprecated* :tabs-sync-option: //Manually maintained attributes :group: DSL *Since Camel {since}* +WARNING: Modeline is deprecated, and will be removed in a future release. Declare the dependencies of an +integration in `application.properties` with `camel.jbang.dependencies=groupId:artifactId:version` (several separated +by comma), or with `camel run --dep`, instead of `//DEPS` lines in the route files. + == Camel CLI -There is support for https://www.jbang.dev/documentation/guide/latest/dependencies.html[JBang dependencies] using the `//DEPS` comments style, -when using Camel CLI. +The Camel CLI reads https://www.jbang.dev/documentation/guide/latest/dependencies.html[JBang dependencies] in the +`//DEPS` comment style: a route file can name the extra Maven dependencies it needs, and `camel run` downloads them and +adds them to the classpath. To find them, Camel reads every route file before it loads the routes, and logs a WARN for +each file that has `//DEPS` lines. + +A `//DEPS` line is a comment in the comment style of the file, such as `//DEPS com.example:my-library:1.0` in a Java +route and `#//DEPS com.example:my-library:1.0` in a YAML route. One line can name several coordinates, separated by +spaces; a coordinate that ends with `@pom` is skipped, and a coordinate can use a JVM system property as `${name}` or +`${name:default}`. + +The same dependencies in `application.properties`: + +[source,properties] +---- +camel.jbang.dependencies=com.example:my-library:1.0,com.example:other-library:2.1 +---- + +Modelines are on with `camel run` (the `--modeline` option, `true` by default) and in the `dev` profile of Camel Main +(`camel.main.modeline`). diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json index 5e76b1a44469..9aa65b9f6e5e 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json @@ -112,7 +112,7 @@ { "name": "camel.main.mdcLoggingKeysPattern", "required": false, "description": "Sets the pattern used for determine which custom MDC keys to propagate during message routing when the routing engine continues routing asynchronously for the given message. Setting this pattern to * will propagate all custom keys. Or setting the pattern to foo*,bar* will propagate any keys starting with either foo or bar. Notice that a set of standard Camel MDC keys are always propagated which starts wi [...] { "name": "camel.main.messageHistory", "required": false, "description": "Sets whether message history is enabled or not. Default is false.", "sourceType": "org.apache.camel.main.DefaultConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": false, "secret": false }, { "name": "camel.main.messageSizeEnabled", "required": false, "description": "Sets whether message size observation is enabled (default is false). When enabled, Camel will compute the size of message body and headers (in bytes) per endpoint (for both IN and OUT directions) and make this available via JMX MBeans (min\/max\/mean body size and headers size).", "sourceType": "org.apache.camel.main.DefaultConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": [...] - { "name": "camel.main.modeline", "required": false, "description": "Whether to support JBang style \/\/DEPS to specify additional dependencies when running Camel CLI", "sourceType": "org.apache.camel.main.DefaultConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": false, "secret": false }, + { "name": "camel.main.modeline", "required": false, "description": "Whether to support JBang style \/\/DEPS to specify additional dependencies when running Camel CLI", "sourceType": "org.apache.camel.main.DefaultConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": false, "secret": false, "deprecated": true }, { "name": "camel.main.name", "required": false, "description": "Sets the name of the CamelContext.", "sourceType": "org.apache.camel.main.DefaultConfigurationProperties", "type": "string", "javaType": "java.lang.String", "secret": false }, { "name": "camel.main.producerTemplateCacheSize", "required": false, "description": "Producer template endpoints cache size.", "sourceType": "org.apache.camel.main.DefaultConfigurationProperties", "type": "integer", "javaType": "int", "defaultValue": 1000, "secret": false }, { "name": "camel.main.profile", "required": false, "description": "Camel profile to use when running. The dev profile is for development, which enables a set of additional developer focus functionality, tracing, debugging, and gathering additional runtime statistics that are useful during development. However, those additional features has a slight overhead cost, and are not enabled for production profile. The default profile is prod.", "sourceType": "org.apache.camel.main.DefaultCon [...] diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/others/dsl-modeline.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/others/dsl-modeline.json index 3189d7e9087a..39dd332bdb19 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/others/dsl-modeline.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/others/dsl-modeline.json @@ -4,7 +4,7 @@ "name": "dsl-modeline", "title": "DSL Modeline", "description": "Camel DSL modeline", - "deprecated": false, + "deprecated": true, "firstVersion": "3.16.0", "label": "dsl", "supportLevel": "Stable", diff --git a/core/camel-api/src/main/java/org/apache/camel/CamelContext.java b/core/camel-api/src/main/java/org/apache/camel/CamelContext.java index 48124c3c8249..ee10786abd79 100644 --- a/core/camel-api/src/main/java/org/apache/camel/CamelContext.java +++ b/core/camel-api/src/main/java/org/apache/camel/CamelContext.java @@ -1621,15 +1621,21 @@ public interface CamelContext extends CamelContextLifecycle, RuntimeConfiguratio /** * Whether to support JBang style //DEPS to specify additional dependencies when running Camel CLI * - * @since 3.16 + * @since 3.16 + * @deprecated //DEPS lines in route files are deprecated, and will be removed in a future release. Declare the + * dependencies in application.properties (camel.jbang.dependencies) or with camel run --dep instead. */ + @Deprecated(since = "4.25.0") Boolean isModeline(); /** * Whether to support JBang style //DEPS to specify additional dependencies when running Camel CLI * - * @since 3.16 + * @since 3.16 + * @deprecated //DEPS lines in route files are deprecated, and will be removed in a future release. Declare the + * dependencies in application.properties (camel.jbang.dependencies) or with camel run --dep instead. */ + @Deprecated(since = "4.25.0") void setModeline(Boolean modeline); /** diff --git a/core/camel-api/src/main/java/org/apache/camel/spi/ModelineFactory.java b/core/camel-api/src/main/java/org/apache/camel/spi/ModelineFactory.java index 2df2fe17e773..5b6ba394075a 100644 --- a/core/camel-api/src/main/java/org/apache/camel/spi/ModelineFactory.java +++ b/core/camel-api/src/main/java/org/apache/camel/spi/ModelineFactory.java @@ -19,8 +19,11 @@ package org.apache.camel.spi; /** * Factory for parsing modeline when running Camel CLI standalone with DSLs. * - * @since 3.16 + * @since 3.16 + * @deprecated //DEPS lines in route files are deprecated, and will be removed in a future release. Declare the + * dependencies in application.properties (camel.jbang.dependencies) or with camel run --dep instead. */ +@Deprecated(since = "4.25.0") public interface ModelineFactory { /** diff --git a/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json b/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json index 5e76b1a44469..9aa65b9f6e5e 100644 --- a/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json +++ b/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json @@ -112,7 +112,7 @@ { "name": "camel.main.mdcLoggingKeysPattern", "required": false, "description": "Sets the pattern used for determine which custom MDC keys to propagate during message routing when the routing engine continues routing asynchronously for the given message. Setting this pattern to * will propagate all custom keys. Or setting the pattern to foo*,bar* will propagate any keys starting with either foo or bar. Notice that a set of standard Camel MDC keys are always propagated which starts wi [...] { "name": "camel.main.messageHistory", "required": false, "description": "Sets whether message history is enabled or not. Default is false.", "sourceType": "org.apache.camel.main.DefaultConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": false, "secret": false }, { "name": "camel.main.messageSizeEnabled", "required": false, "description": "Sets whether message size observation is enabled (default is false). When enabled, Camel will compute the size of message body and headers (in bytes) per endpoint (for both IN and OUT directions) and make this available via JMX MBeans (min\/max\/mean body size and headers size).", "sourceType": "org.apache.camel.main.DefaultConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": [...] - { "name": "camel.main.modeline", "required": false, "description": "Whether to support JBang style \/\/DEPS to specify additional dependencies when running Camel CLI", "sourceType": "org.apache.camel.main.DefaultConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": false, "secret": false }, + { "name": "camel.main.modeline", "required": false, "description": "Whether to support JBang style \/\/DEPS to specify additional dependencies when running Camel CLI", "sourceType": "org.apache.camel.main.DefaultConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": false, "secret": false, "deprecated": true }, { "name": "camel.main.name", "required": false, "description": "Sets the name of the CamelContext.", "sourceType": "org.apache.camel.main.DefaultConfigurationProperties", "type": "string", "javaType": "java.lang.String", "secret": false }, { "name": "camel.main.producerTemplateCacheSize", "required": false, "description": "Producer template endpoints cache size.", "sourceType": "org.apache.camel.main.DefaultConfigurationProperties", "type": "integer", "javaType": "int", "defaultValue": 1000, "secret": false }, { "name": "camel.main.profile", "required": false, "description": "Camel profile to use when running. The dev profile is for development, which enables a set of additional developer focus functionality, tracing, debugging, and gathering additional runtime statistics that are useful during development. However, those additional features has a slight overhead cost, and are not enabled for production profile. The default profile is prod.", "sourceType": "org.apache.camel.main.DefaultCon [...] diff --git a/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationProperties.java b/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationProperties.java index a9aaeef62f8b..e37d866879e1 100644 --- a/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationProperties.java +++ b/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationProperties.java @@ -479,14 +479,22 @@ public abstract class DefaultConfigurationProperties<T> { /** * Whether to support JBang style //DEPS to specify additional dependencies when running Camel CLI + * + * @deprecated //DEPS lines in route files are deprecated, and will be removed in a future release. Declare the + * dependencies in application.properties (camel.jbang.dependencies) or with camel run --dep instead. */ + @Deprecated(since = "4.25.0") public boolean isModeline() { return modeline; } /** * Whether to support JBang style //DEPS to specify additional dependencies when running Camel CLI + * + * @deprecated //DEPS lines in route files are deprecated, and will be removed in a future release. Declare the + * dependencies in application.properties (camel.jbang.dependencies) or with camel run --dep instead. */ + @Deprecated(since = "4.25.0") public void setModeline(boolean modeline) { this.modeline = modeline; } @@ -2048,7 +2056,11 @@ public abstract class DefaultConfigurationProperties<T> { /** * Whether to support JBang style //DEPS to specify additional dependencies when running Camel CLI + * + * @deprecated //DEPS lines in route files are deprecated, and will be removed in a future release. Declare the + * dependencies in application.properties (camel.jbang.dependencies) or with camel run --dep instead. */ + @Deprecated(since = "4.25.0") public T withModeline(boolean modeline) { this.modeline = modeline; return (T) this; diff --git a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_25.adoc b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_25.adoc index df2c96a64ddc..539764ffd702 100644 --- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_25.adoc +++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_25.adoc @@ -13,6 +13,21 @@ See the xref:camel-upgrade-recipes-tool.adoc[documentation] page for details. == Upgrading Camel 4.24 to 4.25 +=== Modeline (//DEPS lines in route files) deprecated + +Modeline, the JBang style `//DEPS` lines in route files that `camel run` reads to download extra dependencies, is +deprecated, and will be removed in a future release. Camel logs a WARN for each route file that has `//DEPS` lines. +Declare the dependencies in `application.properties` instead: + +[source,properties] +---- +camel.jbang.dependencies=com.example:my-library:1.0,com.example:other-library:2.1 +---- + +or with `camel run --dep`. Deprecated with it: the `camel-dsl-modeline` component, the `camel.main.modeline` option, +`CamelContext.setModeline` / `isModeline`, the `ModelineFactory` SPI and the `camel run --modeline` option. The +`camel dependency list` and `camel dependency update` commands keep handling the `//DEPS` lines of JBang scripts. + === camel-pqc - default-material accessors and provider resolution The `PQCDefault*Material` helper classes now initialize their default cryptographic material lazily. Their backing diff --git a/docs/user-manual/modules/ROOT/pages/camel-jbang-devtools.adoc b/docs/user-manual/modules/ROOT/pages/camel-jbang-devtools.adoc index 090595ff1ddf..f29030a2a115 100644 --- a/docs/user-manual/modules/ROOT/pages/camel-jbang-devtools.adoc +++ b/docs/user-manual/modules/ROOT/pages/camel-jbang-devtools.adoc @@ -284,6 +284,10 @@ Declare dependencies with https://www.jbang.dev/documentation/jbang/latest/depen TIP: In YAML DSL, use `\#//DEPS` (YAML comment prefix). +NOTE: `camel run` also reads these `//DEPS` lines (modeline), but that is deprecated and will be removed in a future +release. For `camel run`, declare the dependencies in `application.properties` with +`camel.jbang.dependencies=groupId:artifactId:version`, or with `camel run --dep`. + Example `foo.java`: [source,java] diff --git a/docs/user-manual/modules/ROOT/pages/camel-jbang-mcp.adoc b/docs/user-manual/modules/ROOT/pages/camel-jbang-mcp.adoc index b3b894b3649f..d9f48a4201d9 100644 --- a/docs/user-manual/modules/ROOT/pages/camel-jbang-mcp.adoc +++ b/docs/user-manual/modules/ROOT/pages/camel-jbang-mcp.adoc @@ -102,8 +102,8 @@ questions that no tool answers and that agents otherwise go hunting for: * The rules: components by URI scheme (`smtp`, not `mail`; `platform-http` for an HTTP server); `onException`, `errorHandler`, `routeConfiguration`, `intercept` and `onCompletion` are top-level entries, not steps, and `handled`/`continued` are expressions; under `camel run`, `camel.server.port` (or `--port`) sets the HTTP port, and - extra jars go in a `//DEPS` line, `camel.jbang.dependencies` in `application.properties`, or `--dep` (the - `camel_run` tool has no dependencies argument); the mail Subject, From and To headers are ignored unless + extra jars go in `camel.jbang.dependencies` in `application.properties`, or `--dep` (the `camel_run` tool has no + dependencies argument, and `//DEPS` lines in source files are deprecated); the mail Subject, From and To headers are ignored unless `useHeaderSubject`, `useHeaderFrom` and `useHeaderRecipients` are `true`; remove the `Camel*` headers you did not set yourself before an http or mail producer; `xslt` gets the headers and variables as stylesheet parameters; a source that passes the schema can still fail at runtime, so run it and read the log. diff --git a/docs/user-manual/modules/ROOT/pages/camel-jbang-tui-observe.adoc b/docs/user-manual/modules/ROOT/pages/camel-jbang-tui-observe.adoc index 714bd3e4b021..ca1fd35a1366 100644 --- a/docs/user-manual/modules/ROOT/pages/camel-jbang-tui-observe.adoc +++ b/docs/user-manual/modules/ROOT/pages/camel-jbang-tui-observe.adoc @@ -251,7 +251,7 @@ integration, such as a broker that is not running. * *CVE Audit*: *Shift+F8* asks the AI to explain the selected vulnerability, or all the vulnerabilities of the selected artifact when the tab is grouped by artifact: the severity, the artifacts with the version that fixes each and the dependency chain that brings each in, whether the routes use them, the Apache Camel advisory and the description, with -the change that fixes each (the fixed version to declare with `camel.jbang.dependencies` or `//DEPS`, or the Camel +the change that fixes each (the fixed version to declare with `camel.jbang.dependencies`, or the Camel release to upgrade to). The AI tells whether the integration uses the vulnerable part of the library, offers the change, and changes no file unless you agree. diff --git a/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-debug.adoc b/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-debug.adoc index eafb9685af92..9ef376449175 100644 --- a/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-debug.adoc +++ b/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-debug.adoc @@ -68,7 +68,7 @@ camel debug [options] | `--mcp-stdio` | Expose tagged ai-tool routes as MCP tools over process stdin/stdout for IDE subprocess integration (no HTTP port). Requires --mcp-tags or camel.server.mcp-tags. Logging and startup summaries are routed to stderr so stdout carries MCP protocol only. | false | boolean | `--mcp-tags` | Comma-separated ai-tool tags to expose on the ai-tool MCP server (maps to camel.server.mcp-tags). Use with --mcp-stdio or when camel.server.mcp-enabled is configured for HTTP transport. Not used by --mcp (dev/diagnostics MCP). | | String | `--metrics` _(deprecated)_ | Deprecated: use --observe instead. Metrics (Micrometer and Prometheus) at /q/metrics on local HTTP server (port 8080 by default) | false | boolean -| `--modeline` | Whether to support JBang style //DEPS to specify additional dependencies | true | boolean +| `--modeline` | Whether to support JBang style //DEPS to specify additional dependencies (deprecated: use camel.jbang.dependencies in application.properties or --dep instead) | true | boolean | `--name` | The name of the Camel application. By default the name of the directory when running a whole directory (--source-dir, or a directory), else the name of the first file | CamelJBang | String | `--observe` | Enable observability services (health, metrics, dev console, and lightweight Camel-only tracing in the TUI Spans tab) | false | boolean | `--open-api` | Adds an OpenAPI spec from the given file (json or yaml file) | | String diff --git a/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-dev.adoc b/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-dev.adoc index 6d5b9e51f846..a76a99aa4203 100644 --- a/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-dev.adoc +++ b/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-dev.adoc @@ -64,7 +64,7 @@ camel dev [options] | `--mcp-stdio` | Expose tagged ai-tool routes as MCP tools over process stdin/stdout for IDE subprocess integration (no HTTP port). Requires --mcp-tags or camel.server.mcp-tags. Logging and startup summaries are routed to stderr so stdout carries MCP protocol only. | false | boolean | `--mcp-tags` | Comma-separated ai-tool tags to expose on the ai-tool MCP server (maps to camel.server.mcp-tags). Use with --mcp-stdio or when camel.server.mcp-enabled is configured for HTTP transport. Not used by --mcp (dev/diagnostics MCP). | | String | `--metrics` _(deprecated)_ | Deprecated: use --observe instead. Metrics (Micrometer and Prometheus) at /q/metrics on local HTTP server (port 8080 by default) | false | boolean -| `--modeline` | Whether to support JBang style //DEPS to specify additional dependencies | true | boolean +| `--modeline` | Whether to support JBang style //DEPS to specify additional dependencies (deprecated: use camel.jbang.dependencies in application.properties or --dep instead) | true | boolean | `--name` | The name of the Camel application. By default the name of the directory when running a whole directory (--source-dir, or a directory), else the name of the first file | CamelJBang | String | `--observe` | Enable observability services (health, metrics, dev console, and lightweight Camel-only tracing in the TUI Spans tab) | false | boolean | `--open-api` | Adds an OpenAPI spec from the given file (json or yaml file) | | String diff --git a/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-run.adoc b/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-run.adoc index 2e8e40b159a6..c56e16b9f206 100644 --- a/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-run.adoc +++ b/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-run.adoc @@ -64,7 +64,7 @@ camel run [options] | `--mcp-stdio` | Expose tagged ai-tool routes as MCP tools over process stdin/stdout for IDE subprocess integration (no HTTP port). Requires --mcp-tags or camel.server.mcp-tags. Logging and startup summaries are routed to stderr so stdout carries MCP protocol only. | false | boolean | `--mcp-tags` | Comma-separated ai-tool tags to expose on the ai-tool MCP server (maps to camel.server.mcp-tags). Use with --mcp-stdio or when camel.server.mcp-enabled is configured for HTTP transport. Not used by --mcp (dev/diagnostics MCP). | | String | `--metrics` _(deprecated)_ | Deprecated: use --observe instead. Metrics (Micrometer and Prometheus) at /q/metrics on local HTTP server (port 8080 by default) | false | boolean -| `--modeline` | Whether to support JBang style //DEPS to specify additional dependencies | true | boolean +| `--modeline` | Whether to support JBang style //DEPS to specify additional dependencies (deprecated: use camel.jbang.dependencies in application.properties or --dep instead) | true | boolean | `--name` | The name of the Camel application. By default the name of the directory when running a whole directory (--source-dir, or a directory), else the name of the first file | CamelJBang | String | `--observe` | Enable observability services (health, metrics, dev console, and lightweight Camel-only tracing in the TUI Spans tab) | false | boolean | `--open-api` | Adds an OpenAPI spec from the given file (json or yaml file) | | String diff --git a/dsl/camel-dsl-modeline/pom.xml b/dsl/camel-dsl-modeline/pom.xml index e03d09d84d72..07e62df49d52 100644 --- a/dsl/camel-dsl-modeline/pom.xml +++ b/dsl/camel-dsl-modeline/pom.xml @@ -29,7 +29,7 @@ <artifactId>camel-dsl-modeline</artifactId> <packaging>jar</packaging> - <name>Camel :: DSL :: Modeline</name> + <name>Camel :: DSL :: Modeline (deprecated)</name> <description>Camel DSL modeline</description> <properties> diff --git a/dsl/camel-dsl-modeline/src/generated/resources/META-INF/services/org/apache/camel/other.properties b/dsl/camel-dsl-modeline/src/generated/resources/META-INF/services/org/apache/camel/other.properties index 77136cf38feb..c0fa99dcfaad 100644 --- a/dsl/camel-dsl-modeline/src/generated/resources/META-INF/services/org/apache/camel/other.properties +++ b/dsl/camel-dsl-modeline/src/generated/resources/META-INF/services/org/apache/camel/other.properties @@ -3,5 +3,5 @@ name=dsl-modeline groupId=org.apache.camel artifactId=camel-dsl-modeline version=4.24.0-SNAPSHOT -projectName=Camel :: DSL :: Modeline +projectName=Camel :: DSL :: Modeline (deprecated) projectDescription=Camel DSL modeline diff --git a/dsl/camel-dsl-modeline/src/generated/resources/dsl-modeline.json b/dsl/camel-dsl-modeline/src/generated/resources/dsl-modeline.json index 3189d7e9087a..39dd332bdb19 100644 --- a/dsl/camel-dsl-modeline/src/generated/resources/dsl-modeline.json +++ b/dsl/camel-dsl-modeline/src/generated/resources/dsl-modeline.json @@ -4,7 +4,7 @@ "name": "dsl-modeline", "title": "DSL Modeline", "description": "Camel DSL modeline", - "deprecated": false, + "deprecated": true, "firstVersion": "3.16.0", "label": "dsl", "supportLevel": "Stable", diff --git a/dsl/camel-dsl-modeline/src/main/docs/dsl-modeline.adoc b/dsl/camel-dsl-modeline/src/main/docs/dsl-modeline.adoc index b4fe310fe726..5a4fc95e8388 100644 --- a/dsl/camel-dsl-modeline/src/main/docs/dsl-modeline.adoc +++ b/dsl/camel-dsl-modeline/src/main/docs/dsl-modeline.adoc @@ -1,17 +1,39 @@ -= DSL Modeline Component += DSL Modeline Component (deprecated) :doctitle: DSL Modeline :shortname: dsl-modeline :artifactid: camel-dsl-modeline :description: Camel DSL modeline :since: 3.16 -:supportlevel: Stable +:supportlevel: Stable-deprecated +:deprecated: *deprecated* :tabs-sync-option: //Manually maintained attributes :group: DSL *Since Camel {since}* +WARNING: Modeline is deprecated, and will be removed in a future release. Declare the dependencies of an +integration in `application.properties` with `camel.jbang.dependencies=groupId:artifactId:version` (several separated +by comma), or with `camel run --dep`, instead of `//DEPS` lines in the route files. + == Camel CLI -There is support for https://www.jbang.dev/documentation/guide/latest/dependencies.html[JBang dependencies] using the `//DEPS` comments style, -when using Camel CLI. +The Camel CLI reads https://www.jbang.dev/documentation/guide/latest/dependencies.html[JBang dependencies] in the +`//DEPS` comment style: a route file can name the extra Maven dependencies it needs, and `camel run` downloads them and +adds them to the classpath. To find them, Camel reads every route file before it loads the routes, and logs a WARN for +each file that has `//DEPS` lines. + +A `//DEPS` line is a comment in the comment style of the file, such as `//DEPS com.example:my-library:1.0` in a Java +route and `#//DEPS com.example:my-library:1.0` in a YAML route. One line can name several coordinates, separated by +spaces; a coordinate that ends with `@pom` is skipped, and a coordinate can use a JVM system property as `${name}` or +`${name:default}`. + +The same dependencies in `application.properties`: + +[source,properties] +---- +camel.jbang.dependencies=com.example:my-library:1.0,com.example:other-library:2.1 +---- + +Modelines are on with `camel run` (the `--modeline` option, `true` by default) and in the `dev` profile of Camel Main +(`camel.main.modeline`). diff --git a/dsl/camel-dsl-modeline/src/main/java/org/apache/camel/dsl/modeline/DefaultModelineFactory.java b/dsl/camel-dsl-modeline/src/main/java/org/apache/camel/dsl/modeline/DefaultModelineFactory.java index 3fc3ca025fad..59bdebdb4bdf 100644 --- a/dsl/camel-dsl-modeline/src/main/java/org/apache/camel/dsl/modeline/DefaultModelineFactory.java +++ b/dsl/camel-dsl-modeline/src/main/java/org/apache/camel/dsl/modeline/DefaultModelineFactory.java @@ -18,6 +18,8 @@ package org.apache.camel.dsl.modeline; import java.util.ArrayList; import java.util.List; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import org.apache.camel.CamelContext; import org.apache.camel.CamelContextAware; @@ -29,13 +31,26 @@ import org.apache.camel.spi.Resource; import org.apache.camel.spi.annotations.JdkService; import org.apache.camel.support.CamelContextHelper; import org.apache.camel.support.service.ServiceSupport; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +/** + * Parses the modelines (JBang style //DEPS lines) of the route files. + * + * @deprecated //DEPS lines in route files are deprecated, and will be removed in a future release. Declare the + * dependencies in application.properties (camel.jbang.dependencies) or with camel run --dep instead. + */ +@Deprecated(since = "4.25.0") @JdkService(ModelineFactory.FACTORY) public class DefaultModelineFactory extends ServiceSupport implements ModelineFactory, CamelContextAware, NonManagedService, StaticService { + private static final Logger LOG = LoggerFactory.getLogger(DefaultModelineFactory.class); + private CamelContext camelContext; private final ModelineParser jbang = new JBangModelineParser(); + // the route files whose //DEPS lines have been warned about (a file can be parsed more than once) + private final Set<String> warned = ConcurrentHashMap.newKeySet(); private ModelineParser parser; @Override @@ -51,6 +66,16 @@ public class DefaultModelineFactory extends ServiceSupport @Override public void parseModeline(Resource resource) throws Exception { List<CamelContextCustomizer> customizers = new ArrayList<>(jbang.parse(resource)); + if (!customizers.isEmpty()) { + // a resource that is not a file (such as from a string) has no location + String location = resource.getLocation() != null ? resource.getLocation() : "the route source"; + if (warned.add(location)) { + LOG.warn("The //DEPS lines in {} are deprecated, and will be removed in a future release." + + " Declare the dependencies in application.properties" + + " (camel.jbang.dependencies=group:artifact:version) or with camel run --dep instead.", + location); + } + } // custom parser which may return null if (parser != null) { var list = parser.parse(resource); diff --git a/dsl/camel-dsl-modeline/src/main/java/org/apache/camel/dsl/modeline/JBangModelineParser.java b/dsl/camel-dsl-modeline/src/main/java/org/apache/camel/dsl/modeline/JBangModelineParser.java index 2c8386f823bf..9efdc9004d11 100644 --- a/dsl/camel-dsl-modeline/src/main/java/org/apache/camel/dsl/modeline/JBangModelineParser.java +++ b/dsl/camel-dsl-modeline/src/main/java/org/apache/camel/dsl/modeline/JBangModelineParser.java @@ -27,6 +27,13 @@ import org.apache.camel.spi.Resource; import org.apache.camel.util.StringHelper; import org.apache.camel.util.StringQuoteHelper; +/** + * Parses the JBang style //DEPS lines of a route file. + * + * @deprecated //DEPS lines in route files are deprecated, and will be removed in a future release. Declare the + * dependencies in application.properties (camel.jbang.dependencies) or with camel run --dep instead. + */ +@Deprecated(since = "4.25.0") public class JBangModelineParser implements ModelineParser { public static final String JBANG_DEPS_START = "//DEPS"; diff --git a/dsl/camel-dsl-modeline/src/main/java/org/apache/camel/dsl/modeline/ModelineParser.java b/dsl/camel-dsl-modeline/src/main/java/org/apache/camel/dsl/modeline/ModelineParser.java index 0b3e7e98374a..9b3ce0c6d4df 100644 --- a/dsl/camel-dsl-modeline/src/main/java/org/apache/camel/dsl/modeline/ModelineParser.java +++ b/dsl/camel-dsl-modeline/src/main/java/org/apache/camel/dsl/modeline/ModelineParser.java @@ -23,7 +23,11 @@ import org.apache.camel.spi.Resource; /** * Modeline parser + * + * @deprecated //DEPS lines in route files are deprecated, and will be removed in a future release. Declare the + * dependencies in application.properties (camel.jbang.dependencies) or with camel run --dep instead. */ +@Deprecated(since = "4.25.0") public interface ModelineParser { /** diff --git a/dsl/camel-jbang/camel-jbang-core/src/generated/resources/META-INF/camel-jbang-commands-metadata.json b/dsl/camel-jbang/camel-jbang-core/src/generated/resources/META-INF/camel-jbang-commands-metadata.json index 955b3bff1542..2f9490b345b6 100644 --- a/dsl/camel-jbang/camel-jbang-core/src/generated/resources/META-INF/camel-jbang-commands-metadata.json +++ b/dsl/camel-jbang/camel-jbang-core/src/generated/resources/META-INF/camel-jbang-commands-metadata.json @@ -5,9 +5,9 @@ { "name": "cmd", "fullName": "cmd", "description": "Performs commands in the running Camel integrations, such as start\/stop route, or change logging levels.", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.action.CamelAction", "options": [ { "names": "-h,--help", "description": "Display this help and exit", "javaType": "boolean", "type": "boolean" } ], "subcommands": [ { "name": "browse", "fullName": "cmd browse", "description": "Browse pending messages on endpoints", "sou [...] { "name": "completion", "fullName": "completion", "description": "Generate completion script for bash\/zsh", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.Complete", "options": [ { "names": "-h,--help", "description": "Display this help and exit", "javaType": "boolean", "type": "boolean" } ] }, { "name": "config", "fullName": "config", "description": "Get and set user configuration values", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.config.ConfigCommand", "options": [ { "names": "-h,--help", "description": "Display this help and exit", "javaType": "boolean", "type": "boolean" } ], "subcommands": [ { "name": "get", "fullName": "config get", "description": "Display user configuration value", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.config.ConfigG [...] - { "name": "debug", "fullName": "debug", "description": "Debug local Camel integration", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.Debug", "options": [ { "names": "--ago", "description": "Use ago instead of yyyy-MM-dd HH:mm:ss in timestamp.", "javaType": "boolean", "type": "boolean" }, { "names": "--background", "description": "Run in the background", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--background-wait", "description": "How [...] + { "name": "debug", "fullName": "debug", "description": "Debug local Camel integration", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.Debug", "options": [ { "names": "--ago", "description": "Use ago instead of yyyy-MM-dd HH:mm:ss in timestamp.", "javaType": "boolean", "type": "boolean" }, { "names": "--background", "description": "Run in the background", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--background-wait", "description": "How [...] { "name": "dependency", "fullName": "dependency", "description": "Displays all Camel dependencies required to run", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.DependencyCommand", "options": [ { "names": "-h,--help", "description": "Display this help and exit", "javaType": "boolean", "type": "boolean" } ], "subcommands": [ { "name": "audit", "fullName": "dependency audit", "description": "Checks the dependencies for known vulnerabilities (CVEs) with OSV.dev and the Apach [...] - { "name": "dev", "fullName": "dev", "description": "Run in dev mode with live reload", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.Dev", "options": [ { "names": "--background", "description": "Run in the background", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--background-wait", "description": "How long to wait for the integration in the background to start, before returning, in millis or as a duration such as 2m (true waits 60 secon [...] + { "name": "dev", "fullName": "dev", "description": "Run in dev mode with live reload", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.Dev", "options": [ { "names": "--background", "description": "Run in the background", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--background-wait", "description": "How long to wait for the integration in the background to start, before returning, in millis or as a duration such as 2m (true waits 60 secon [...] { "name": "dirty", "fullName": "dirty", "description": "Check if there are dirty files from previous Camel runs that did not terminate gracefully", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.process.Dirty", "options": [ { "names": "--clean", "description": "Clean dirty files which are no longer in use, and the logs of the previous runs of the integrations (camel log --previous)", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "-h,--help" [...] { "name": "doc", "fullName": "doc", "description": "Shows documentation for kamelet, component, EIP, and other Camel resources", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.catalog.CatalogDoc", "options": [ { "names": "--camel-version", "description": "To use a different Camel version than the default version", "javaType": "java.lang.String", "type": "string" }, { "names": "--download", "description": "Whether to allow automatic downloading JAR dependencies (over the int [...] { "name": "doctor", "fullName": "doctor", "description": "Checks the environment and reports potential issues", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.Doctor", "options": [ { "names": "--json", "description": "Output in JSON Format: the status (OK, WARN or FAIL) of each check", "javaType": "boolean", "type": "boolean" }, { "names": "-h,--help", "description": "Display this help and exit", "javaType": "boolean", "type": "boolean" } ] }, @@ -26,7 +26,7 @@ { "name": "plugin", "fullName": "plugin", "description": "Manage plugins that add sub-commands to this CLI", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.plugin.PluginCommand", "options": [ { "names": "-h,--help", "description": "Display this help and exit", "javaType": "boolean", "type": "boolean" } ], "subcommands": [ { "name": "add", "fullName": "plugin add", "description": "Add new plugin", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.plugin.PluginAdd", "o [...] { "name": "ps", "fullName": "ps", "description": "List running Camel integrations", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.process.ListProcess", "options": [ { "names": "--duration", "description": "How long to keep watching or following, in millis or as a duration such as 30s (default: until Enter is pressed)", "javaType": "long", "type": "integer" }, { "names": "--json", "description": "Output in JSON Format", "javaType": "boolean", "type": "boolean" }, { "names": [...] { "name": "restart", "fullName": "restart", "description": "Restarts running Camel integrations (stop + re-launch)", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.process.RestartProcess", "options": [ { "names": "--timeout", "description": "How long to wait for the integration to stop, and again to start, in millis or as a duration such as 30s", "defaultValue": "60000", "javaType": "long", "type": "integer" }, { "names": "-h,--help", "description": "Display this help and e [...] - { "name": "run", "fullName": "run", "description": "Run as local Camel integration", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.Run", "options": [ { "names": "--background", "description": "Run in the background", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--background-wait", "description": "How long to wait for the integration in the background to start, before returning, in millis or as a duration such as 2m (true waits 60 seconds [...] + { "name": "run", "fullName": "run", "description": "Run as local Camel integration", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.Run", "options": [ { "names": "--background", "description": "Run in the background", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--background-wait", "description": "How long to wait for the integration in the background to start, before returning, in millis or as a duration such as 2m (true waits 60 seconds [...] { "name": "sbom", "fullName": "sbom", "description": "Generate a CycloneDX or SPDX SBOM for a specific project", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.SBOMGenerator", "options": [ { "names": "--build-property", "description": "Maven build properties, ex. --build-property=prop1=foo", "javaType": "java.util.List", "type": "array" }, { "names": "--camel-spring-boot-version", "description": "Camel version to use with Spring Boot", "javaType": "java.lang.String", "type" [...] { "name": "script", "fullName": "script", "description": "Run Camel integration as shell script for terminal scripting", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.Script", "options": [ { "names": "--logging", "description": "Can be used to turn on logging (logs to file in <user home>\/.camel directory)", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--logging-level", "description": "Logging level (ERROR, WARN, INFO, DEBUG, TRACE)", "d [...] { "name": "semantic", "fullName": "semantic", "description": "List semantic definitions and expert contracts", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.action.CamelSemantic", "options": [ { "names": "--expert", "description": "Show the operations and parameter contract of this expert", "javaType": "java.lang.String", "type": "string" }, { "names": "--json", "description": "Output a single JSON document", "javaType": "boolean", "type": "boolean" }, { "names": "--timeou [...] 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 2b32d1f25d24..a5043ed1648a 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 @@ -339,7 +339,9 @@ public class Run extends CamelCommand implements CommandLifecycle { // port, managementPort, console, health, metrics, observe options are in ServerOptions @Mixin @Option(name = "modeline", hasValue = false, - description = "Whether to support JBang style //DEPS to specify additional dependencies", defaultValue = "true") + description = "Whether to support JBang style //DEPS to specify additional dependencies (deprecated: use" + + " camel.jbang.dependencies in application.properties or --dep instead)", + defaultValue = "true") boolean modeline = true; @Option(name = "open-api", description = "Adds an OpenAPI spec from the given file (json or yaml file)") diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ai/GroovyImportChecks.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ai/GroovyImportChecks.java index 5f2369cebc0f..ab759c81eb58 100644 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ai/GroovyImportChecks.java +++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ai/GroovyImportChecks.java @@ -127,7 +127,7 @@ public final class GroovyImportChecks { errors.add("Line " + lineNum + ": the Groovy import " + fqcn + " is not a class of the JDK, Groovy, Camel" + " or this project, and not a known library: declare the library that provides it as a" + " dependency (with the Camel CLI camel.jbang.dependencies=groupId:artifactId:version in" - + " application.properties or a //DEPS line; in a Maven project a pom dependency), or put" + + " application.properties, or --dep; in a Maven project a pom dependency), or put" + " the class in a .groovy or .java file next to the route"); } } diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ai/JavaChecks.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ai/JavaChecks.java index e05177d696d8..3d3d6bb56f30 100644 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ai/JavaChecks.java +++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ai/JavaChecks.java @@ -136,8 +136,8 @@ final class JavaChecks { if (first.contains("cannot find symbol") && !first.contains("symbol: method") || first.contains("package") && first.contains("does not exist")) { msgs.set(0, first + " (the class is compiled when camel run starts against the CLI classpath: Camel and" - + " the JDK; another library needs a //DEPS group:artifact:version line at the top of" - + " the Java file, or the dependency added to the run)"); + + " the JDK; another library needs camel.jbang.dependencies=group:artifact:version in" + + " application.properties, or the dependency added to the run with --dep)"); } } return msgs; diff --git a/dsl/camel-jbang/camel-jbang-core/src/test/resources/golden/cli-help.txt b/dsl/camel-jbang/camel-jbang-core/src/test/resources/golden/cli-help.txt index 5839577a8a4a..a56ac4362cc9 100644 --- a/dsl/camel-jbang/camel-jbang-core/src/test/resources/golden/cli-help.txt +++ b/dsl/camel-jbang/camel-jbang-core/src/test/resources/golden/cli-help.txt @@ -2351,7 +2351,9 @@ Options: Kamelets (takes precedence). Multiple directories can be specified separated by comma. --modeline Whether to support JBang style //DEPS to specify - additional dependencies + additional dependencies (deprecated: use + camel.jbang.dependencies in application.properties + or --dep instead) Default: true --open-api=<open-api> Adds an OpenAPI spec from the given file (json or @@ -3846,7 +3848,9 @@ Options: Kamelets (takes precedence). Multiple directories can be specified separated by comma. --modeline Whether to support JBang style //DEPS to specify - additional dependencies + additional dependencies (deprecated: use + camel.jbang.dependencies in application.properties + or --dep instead) Default: true --open-api=<open-api> Adds an OpenAPI spec from the given file (json or @@ -6303,7 +6307,9 @@ Options: Kamelets (takes precedence). Multiple directories can be specified separated by comma. --modeline Whether to support JBang style //DEPS to specify - additional dependencies + additional dependencies (deprecated: use + camel.jbang.dependencies in application.properties + or --dep instead) Default: true --open-api=<open-api> Adds an OpenAPI spec from the given file (json or diff --git a/dsl/camel-jbang/camel-jbang-mcp/src/main/java/org/apache/camel/dsl/jbang/core/commands/mcp/McpServerInstructions.java b/dsl/camel-jbang/camel-jbang-mcp/src/main/java/org/apache/camel/dsl/jbang/core/commands/mcp/McpServerInstructions.java index f5c052f59ea3..a2d777aa778d 100644 --- a/dsl/camel-jbang/camel-jbang-mcp/src/main/java/org/apache/camel/dsl/jbang/core/commands/mcp/McpServerInstructions.java +++ b/dsl/camel-jbang/camel-jbang-mcp/src/main/java/org/apache/camel/dsl/jbang/core/commands/mcp/McpServerInstructions.java @@ -60,9 +60,10 @@ public class McpServerInstructions implements InitialResponseInfo { - YAML DSL: onException, errorHandler, routeConfiguration, intercept and onCompletion are top-level \ entries beside route (or inside routeConfiguration), never steps. handled and continued are \ expressions: handled: {constant: {expression: "true"}}. - - camel run: camel.server.port (or camel run --port) sets the HTTP port. Extra jars: a //DEPS line in a \ - source file, camel.jbang.dependencies=group:artifact:version in application.properties, or --dep on the \ - command line (camel_run has no dependencies argument, so use one of the first two). + - camel run: camel.server.port (or camel run --port) sets the HTTP port. Extra jars: \ + camel.jbang.dependencies=group:artifact:version in application.properties, or --dep on the command line \ + (camel_run has no dependencies argument, so use application.properties). //DEPS lines in source files \ + are deprecated. - mail producer: the Subject, From and To headers are ignored unless useHeaderSubject=true, \ useHeaderFrom=true and useHeaderRecipients=true; otherwise use the subject, from and to options. - Before an http or mail producer, remove the Camel* headers you did not set yourself \ diff --git a/dsl/camel-jbang/camel-jbang-mcp/src/test/java/org/apache/camel/dsl/jbang/core/commands/mcp/McpServerInstructionsTest.java b/dsl/camel-jbang/camel-jbang-mcp/src/test/java/org/apache/camel/dsl/jbang/core/commands/mcp/McpServerInstructionsTest.java index cdec38c33ad0..9123e5711ce7 100644 --- a/dsl/camel-jbang/camel-jbang-mcp/src/test/java/org/apache/camel/dsl/jbang/core/commands/mcp/McpServerInstructionsTest.java +++ b/dsl/camel-jbang/camel-jbang-mcp/src/test/java/org/apache/camel/dsl/jbang/core/commands/mcp/McpServerInstructionsTest.java @@ -64,7 +64,7 @@ class McpServerInstructionsTest { assertThat(text).containsSubsequence( "URI scheme: smtp", "platform-http", "top-level", "handled: {constant: {expression: \"true\"}}", - "camel.server.port", "//DEPS", "camel.jbang.dependencies", "--dep", + "camel.server.port", "camel.jbang.dependencies", "--dep", "//DEPS", "useHeaderSubject=true", "useHeaderFrom=true", "useHeaderRecipients=true", "removeHeaders", "Camel*", "xslt", "headers and variables", diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CveAiPrompt.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CveAiPrompt.java index 47969576ad73..0d8c8f525677 100644 --- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CveAiPrompt.java +++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CveAiPrompt.java @@ -172,7 +172,7 @@ final class CveAiPrompt { return ga + ": use " + ga + ":" + fix + " where the project declares it (//DEPS," + " camel.jbang.dependencies or --dep)"; } - return ga + ": declare " + ga + ":" + fix + " in the project (camel.jbang.dependencies or //DEPS) to use the" + return ga + ": declare " + ga + ":" + fix + " in the project (camel.jbang.dependencies) to use the" + " fixed version instead of the one " + (via != null ? via : "the runtime") + " brings in, or upgrade" + " Camel when a newer release brings a fixed version"; } diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/CveAiPromptTest.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/CveAiPromptTest.java index bd52582e1ab8..dd62ddfb5a56 100644 --- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/CveAiPromptTest.java +++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/CveAiPromptTest.java @@ -84,7 +84,7 @@ class CveAiPromptTest { .doesNotContain("x".repeat(CveAiPrompt.MAX_DETAILS + 1)) // CAMEL-27328: the change that fixes it, for the AI to offer .contains("Suggested changes:\n- com.example:xml-parser: declare com.example:xml-parser:2.1.4 in the" - + " project (camel.jbang.dependencies or //DEPS) to use the fixed version instead of the one" + + " project (camel.jbang.dependencies) to use the fixed version instead of the one" + " camel-jacksonxml brings in") .endsWith("Make no changes to the files unless I agree."); }
