Thomas Raddatz created CAMEL-26558:
--------------------------------------
Summary: camel-jbang - Export to Quarkus drops
camel-quarkus-microprofile-health from the pom.xml, also when it is asked for
with --dep
Key: CAMEL-26558
URL: https://issues.apache.org/jira/browse/CAMEL-26558
Project: Camel
Issue Type: Bug
Components: camel-jbang
Affects Versions: 4.23.0, 4.22.2, 4.18.5, 4.14.0
Reporter: Thomas Raddatz
{{camel export \-\-runtime=quarkus}} never writes
{{org.apache.camel.quarkus:camel-quarkus-microprofile-health}} to the exported
{{pom.xml}}, however the dependency is given:
{{\-\-dep=camel:microprofile-health}},
{{\-\-dep=org.apache.camel:camel-microprofile-health}},
{{\-\-dep=org.apache.camel.quarkus:camel-quarkus-microprofile-health}} or
{{camel.jbang.dependencies=camel:microprofile-health}} in
{{application.properties}}. The export reports success without a warning, and
the exported application starts without the SmallRye Health extension, so it
has no {{/q/health}} endpoint and no Camel health checks.
The Quarkus export treats the extension as one that its POM template always
contains and removes it twice ({{ExportQuarkus}} in camel-jbang-core up to
4.23, {{QuarkusExporter}} in camel-jbang-run on main since CAMEL-24724):
* {{resolveDependencies}} removes every dependency that contains
{{camel-microprofile-health}} as an "out of the box" dependency,
* the loop that builds the dependency list for the template skips
{{camel-quarkus-microprofile-health}} with the comment "Special case,
quarkus-pom.ftl already has them included."
The template ({{quarkus-pom.ftl}}, {{quarkus-pom.tmpl}} up to 4.18) contains
only {{camel-quarkus-core}}, though.
h3. Reproduction (Camel CLI 4.23.0)
{code:bash}
camel init hello.camel.yaml
camel export hello.camel.yaml --runtime=quarkus --gav=org.example:hello:1.0.0
--dir=out \
--dep=camel:microprofile-health --dep=camel:jackson
grep -E -o 'camel-quarkus-(microprofile-health|jackson)' out/pom.xml
{code}
{noformat}
camel-quarkus-jackson
{noformat}
{{camel-quarkus-jackson}} is there, {{camel-quarkus-microprofile-health}} is
not.
h3. History
CAMEL-18719 (3.20.0) added the skip for {{camel-quarkus-core}},
{{camel-quarkus-platform-http}} and {{camel-quarkus-microprofile-health}}, the
three extensions the template contained at that time. When commit 0f60409d5ceb
("fix(jbang): include platform-http dependency") took
{{camel-quarkus-platform-http}} out of the template, it removed its skip and
its {{removeIf}} with it. [#17296|https://github.com/apache/camel/pull/17296]
(4.11.0) replaced {{camel-quarkus-microprofile-health}} in the template with
{{camel-quarkus-observability-services}}, which depends on the health
extension, but kept its two exclusions. That did no harm while the template had
{{camel-quarkus-observability-services}}. CAMEL-22187 (4.14.0) removed that
from the template as well, so that only {{\-\-observe}} adds it ({{camel
kubernetes export}} always sets it). Since 4.14.0 the health extension
therefore only comes with {{\-\-observe}}, together with the rest of
{{camel-quarkus-observability-services}} (Micrometer with the Prometheus
registry, OpenTelemetry, management).
The exclusions and the template are the same on the camel-4.14.x, camel-4.18.x,
camel-4.22.x and camel-4.23.x branches (releases 4.18.5, 4.22.2 and 4.23.0) and
on main.
h3. Proposal
Drop {{camel-microprofile-health}} and {{camel-quarkus-microprofile-health}}
from both exclusions, as 0f60409d5ceb did for platform-http, and keep only
{{camel-core}} / {{camel-quarkus-core}}, which the template does contain. With
{{\-\-observe}}, an explicit health dependency next to
{{camel-quarkus-observability-services}} only adds a direct dependency on an
artifact that is there transitively anyway. A test exports with
{{\-\-dep=camel:microprofile-health}} and checks the {{pom.xml}}.
The workaround is to add the dependency to the exported {{pom.xml}} after the
export, or to export with {{\-\-observe}} if the other observability extensions
are wanted as well.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)