Closed tpokki closed 2 years ago
thank you for raising this issue.
this is not the first time we deal with transitive dependencies in various reports and I don't think there is a proper and always correct way to solve this. If we were using gradle, we could enable a certain constraints project wise and enforce a "highest version wins" for example. afaik, maven does not have such a feature, but though we can handle this : read further.
Nevertheless, I really think that we should mitigate this, especially since maven takes the version that is the "closest one", which is not ideal here. Yes, currently we are indeed taking 4.4
version, but a simple alteration in pom.xml
can change that. Let's see how this can be fixed.
The first one reported (commons-collections4
) comes from:
io.kubernetes:client-java
, directly. and the second one comes from :
io.kubernetes:client-java-extended -> com.flipkart.zjsonpatch:zjsonpatch
.It's easy to mitigate this with an exclusion, the obvious issue is if io.kubernetes:client-java-extended
and/or io.kubernetes:client-java
will drop collections4
as their inner dependencies (or some transitive dependency does that).
Another scenario where things can go south for us, is if we will remove let's say io.kubernetes:client-java
in some future version (that brings collections4:4.4
) and in io.kubernetes:client-java-extended
we will add the exclusion...
It get's more fun with every aspect :) The good news here is that collections4
has seen its latest release in 2019
in version 4.4
, it surely looks like the release cycle is either very slow or seeing an end of life. The other good aspect is that we use internally either 4.2
or 4.4
, in every module. This means, this dependency is a good candidate for spring-cloud-kubernetes-dependencies
.
The second dependency comes from io.kubernetes:client-java
and org.springframework.security:spring-security-rsa
. It makes sense why io.kubernetes:client-java
needs it, but I don't understand why we require org.springframework.security:spring-security-rsa
. As a matter of fact, if I remove this dependency and build the project, it builds just fine. imho, we do not need it at all.
That being said here is the PR that attempts to fix these two issues. Let's see what @ryanjbaxter thinks about it.
Describe the bug Version: 2.1.0 Bug: Dependency convergence
The
mvn enforcer:enforce -Drules=dependencyConvergence
fails onspring-cloud-kubernetes-client-config
.The problematic ones are
commons-collections4
andbcpkix-jdk15on
as they are inherited to any project that includes thespring-cloud-kubernetes-client-config
. Other conflicts are with dependencies from test scope, and therefore less relevant for those using this library.Sample