[ 
https://issues.apache.org/jira/browse/CAMEL-24400?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ricardo Martinez updated CAMEL-24400:
-------------------------------------
    Affects Version/s: 4.22.0

> camel export: `-Dcamel.jbang.camel-version` system property is silently 
> ignored
> -------------------------------------------------------------------------------
>
>                 Key: CAMEL-24400
>                 URL: https://issues.apache.org/jira/browse/CAMEL-24400
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-jbang
>    Affects Versions: 4.22.0
>            Reporter: Ricardo Martinez
>            Priority: Minor
>
> The {{camel.jbang.camel-version}} system property (constant {{CAMEL_VERSION}} 
> in {{CamelJBangConstants}}) is documented as a supported configuration option 
> but is never read during export.
> *Steps to reproduce:*
> {code:bash}
> camel export --runtime=quarkus -Dcamel.jbang.camel-version=4.8.0 hello.java
> {code}
> The exported project uses the default/running Camel version, not {{4.8.0}}.
> By contrast, passing the equivalent {{--camel-version=4.8.0}} flag works 
> correctly.
> *Root cause:*
> In {{Export.overrideFromSystemProperties()}} ({{Export.java}}), only two 
> properties are read from system properties:
> {code:java}
> private void overrideFromSystemProperties() {
>     this.quarkusPlatform = QuarkusPlatformMixin.of(System.getProperties(), 
> this.quarkusPlatform);
>     this.camelSpringBootVersion =
>         PropertyResolver.fromSystemProperty(CAMEL_SPRING_BOOT_VERSION, () -> 
> this.camelSpringBootVersion);
> }
> {code}
> {{CAMEL_VERSION}} ({{camel.jbang.camel-version}}) is absent. The property is 
> populated from {{application.properties}} via 
> {{doLoadAndInitProfileProperties()}} but there is no equivalent 
> system-property override path for it.
> *Expected behaviour:*
> Passing {{- Dcamel.jbang.camel-version=X.Y.Z}} should behave identically to 
> {{--camel-version=X.Y.Z}}.
> *Fix:*
> Add the missing line to {{overrideFromSystemProperties()}}:
> {code:java}
> this.camelVersion = PropertyResolver.fromSystemProperty(CAMEL_VERSION, () -> 
> this.camelVersion);
> {code}
> _Reported by IBM Bob on behalf of ricmarti_



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to