Maurice Zeijen created MNG-8581:
-----------------------------------
Summary: Dependency resolution difference between Maven 3 and 4
Key: MNG-8581
URL: https://issues.apache.org/jira/browse/MNG-8581
Project: Maven
Issue Type: Bug
Components: Dependencies
Affects Versions: 4.0.0-rc-2, 3.9.9
Reporter: Maurice Zeijen
h2. Problem
I discovered a dependency resolution difference between Maven 3.9.9 and Maven
4.0.0-rc-2.
When adding the dependency _io.fabric8:kubernetes-httpclient-okhttp:6.13.4_
Maven 3 and 4 will resolve different versions of the transitive
_com.squareup.okio:okio_ dependency.
Resolved versions of Okio:
Maven 3: *_1.15.0_*
Maven 4: *_1.17.6_*
h2. Effect
Due to this unexpected version resolution difference my application failed due
to an MethodNotFoundException with Maven 4 that doesn't occur with Maven
3.{*}{*}
h2. Investigation
I did a small investigation where these versions are coming from. When
depending on _io.fabric8:kubernetes-httpclient-okhttp:6.13.4_ you get the
following dependency path to the Okio dependency:
* _io.fabric8:kubernetes-httpclient-okhttp:6.13.4_
** _com.squareup.okhttp3:okhttp:3.12.12_
*** _com.squareup.okio:okio_
The Okio version is defined in two places within this three and there parents.
* The {_}io.fabric8:{_}{_}kubernetes-httpclient-okhttp{_} has the
io.fabric8:kubernetes-client-project parent, which defines that the okio
version should be *1.17.6*
* The _com.squareup.okhttp3:okhttp_ has the _com.squareup.okhttp3:parent_
project parent, which defines that the okio version should be *1.15.0*
h2. *Reproduction*
pom.xml
{code:java}
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>my.group</groupId>
<artifactId>my-artifact</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-httpclient-okhttp</artifactId>
<version>6.13.4</version>
</dependency>
</dependencies>
</project> {code}
Run _mvn dependency:tree_ with Maven 3.9.9 and Maven 4.0.0-rc-2 and look at the
version of the _com.squareup.okio:okio_ dependency.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)