← All tasks
javakubernetes-client/java #3533Not a task: already works

`optional` tag in `dependencyManagement` is not inherited

envgap__kubernetes-client__java-3533

01 / FAILURE SIGNATURE

As reported upstream

No identifying execution failure has been captured.
Not a benchmark task.
  • The project already builds and runs before the fix, so there is nothing to repair.

02 / ENVIRONMENT RECIPE

Base commit
3f68605238d5738fd185c6bf90933d74397b42b2
Manifest
pom.xml
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

kubernetes-client/java #3533 · read the original issue
**Describe the bug**



The `client-java-parent` POM has a few "optional" dependencies; however, they are no-ops. For example, the dependency tree of a module that uses `io.kubernetes:client-java:jar:19.0.1`:



```

$ mvn dependency:tree

...

[INFO] +- io.kubernetes:client-java:jar:19.0.1:compile

[INFO] |  +- io.prometheus:simpleclient:jar:0.16.0:compile

[INFO] |  |  +- io.prometheus:simpleclient_tracer_otel:jar:0.16.0:compile

[INFO] |  |  |  \- io.prometheus:simpleclient_tracer_common:jar:0.16.0:compile

[INFO] |  |  \- io.prometheus:simpleclient_tracer_otel_agent:jar:0.16.0:compile

[INFO] |  +- io.prometheus:simpleclient_httpserver:jar:0.16.0:compile

[INFO] |  |  \- io.prometheus:simpleclient_common:jar:0.16.0:compile

```



This is because Maven doesn't take the tag into account. See also https://issues.apache.org/jira/browse/MNG-5227 and https://issues.apache.org/jira/browse/MNG-5632. We noticed this issue, because [Coursier](https://get-coursier.io/) seems to take the tag into account unlike Maven.



Could we push optional tags to module POMs and drop them from `dependencyManagement`?



https://github.com/kubernetes-client/java/blob/d7f939125ab13cea9e1a64e150b3ff6781eeb173/pom.xml#L185-L190



https://github.com/kubernetes-client/java/blob/d7f939125ab13cea9e1a64e150b3ff6781eeb173/util/pom.xml#L14-L17



**Client Version**

`19.0.1`



**Kubernetes Version**

`1.26.15`



**Java Version**

Java 21



**To Reproduce**

1. Create a module that depends on `client-java` and run `mvn dependency:tree`. `io.prometheus:simpleclient:jar:0.16.0:compile` will be listed there.



**Expected behavior**

Optional dependencies (e.g., `io.prometheus:simpleclient`) should not be pulled transitively in downstream modules.



**KubeConfig**

N/A



**Server (please complete the following information):**

N/A
Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]