Introduction

In software development, managing dependencies is crucial. However, even a minor change can lead to unexpected issues, as we experienced in our project, Contract Signatures. Our PDF generation suddenly stopped working, and the error message, “NoSuchMethodError (DriverCommandExecutor.<init>),” was far from enlightening.

Initially, we suspected that the migration from Java 20 to 21 was the culprit, but that turned out not to be the case. Instead, we traced the issue back to an upgrade in spring-boot-dependencies from version 3.0.0 to 3.1.4.

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-dependencies</artifactId>
            <type>pom</type>
            <version>3.1.4</version> <!-- from 3.0.0 to 3.1.4-->
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

The Problem

Our project had a dependency on selenium-java:

    <dependencies>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>4.1.3</version>
        </dependency>
    </dependencies>

Let’s see dependency:tree for it. If that is only dependency in project:


[INFO] org.example:sel-dep-test:jar:1.0-SNAPSHOT
[INFO] \- org.seleniumhq.selenium:selenium-java:jar:4.1.3:compile
[INFO]    +- org.seleniumhq.selenium:selenium-api:jar:4.1.3:compile
[INFO]    +- org.seleniumhq.selenium:selenium-chrome-driver:jar:4.1.3:compile
[INFO]    |  [... Skipped ..]
[INFO]    |  +- org.seleniumhq.selenium:selenium-chromium-driver:jar:4.1.3:compile
[INFO]    |  \- org.seleniumhq.selenium:selenium-json:jar:4.1.3:compile
[INFO]    +- org.seleniumhq.selenium:selenium-devtools-v85:jar:4.1.3:compile
[INFO]    +- org.seleniumhq.selenium:selenium-devtools-v97:jar:4.1.3:compile
[INFO]    +- org.seleniumhq.selenium:selenium-devtools-v98:jar:4.1.3:compile
[INFO]    +- org.seleniumhq.selenium:selenium-devtools-v99:jar:4.1.3:compile
[INFO]    +- org.seleniumhq.selenium:selenium-edge-driver:jar:4.1.3:compile
[INFO]    +- org.seleniumhq.selenium:selenium-firefox-driver:jar:4.1.3:compile
[INFO]    +- org.seleniumhq.selenium:selenium-ie-driver:jar:4.1.3:compile
[INFO]    +- org.seleniumhq.selenium:selenium-opera-driver:jar:4.1.3:compile
[INFO]    +- org.seleniumhq.selenium:selenium-remote-driver:jar:4.1.3:compile
[INFO]    |  [... Skipped ..]
[INFO]    +- org.seleniumhq.selenium:selenium-safari-driver:jar:4.1.3:compile
[INFO]    \- org.seleniumhq.selenium:selenium-support:jar:4.1.3:compile

Let’s see dependency:tree if we add spring-boot-dependencies:3.1.4 to dependencyManagement:

[INFO] org.example:sel-dep-test:jar:1.0-SNAPSHOT
[INFO] \- org.seleniumhq.selenium:selenium-java:jar:4.1.3:compile
[INFO]    +- org.seleniumhq.selenium:selenium-api:jar:4.8.3:compile
[INFO]    +- org.seleniumhq.selenium:selenium-chrome-driver:jar:4.8.3:compile
[INFO]    |  [... Skipped ..]
[INFO]    |  +- org.seleniumhq.selenium:selenium-chromium-driver:jar:4.8.3:compile
[INFO]    |  +- org.seleniumhq.selenium:selenium-json:jar:4.8.3:compile
[INFO]    |  \- org.seleniumhq.selenium:selenium-manager:jar:4.8.3:compile
[INFO]    +- org.seleniumhq.selenium:selenium-devtools-v85:jar:4.8.3:compile
[INFO]    +- org.seleniumhq.selenium:selenium-devtools-v97:jar:4.1.3:compile
[INFO]    +- org.seleniumhq.selenium:selenium-devtools-v98:jar:4.1.3:compile
[INFO]    +- org.seleniumhq.selenium:selenium-devtools-v99:jar:4.1.3:compile
[INFO]    +- org.seleniumhq.selenium:selenium-edge-driver:jar:4.8.3:compile
[INFO]    +- org.seleniumhq.selenium:selenium-firefox-driver:jar:4.8.3:compile
[INFO]    |  [... Skipped ..]
[INFO]    +- org.seleniumhq.selenium:selenium-ie-driver:jar:4.8.3:compile
[INFO]    +- org.seleniumhq.selenium:selenium-opera-driver:jar:4.1.3:compile
[INFO]    +- org.seleniumhq.selenium:selenium-remote-driver:jar:4.8.3:compile
[INFO]    |  [... Skipped ..]
[INFO]    +- org.seleniumhq.selenium:selenium-safari-driver:jar:4.8.3:compile
[INFO]    \- org.seleniumhq.selenium:selenium-support:jar:4.8.3:compile

As you can see, the versions are mixed up, with both 4.1.3 and 4.8.3 present. In a complex project, identifying the root cause of this mix-up can be a real challenge. The issue is that dependency:tree doesn’t clearly indicate where version 4.8.3 is coming from. This left us puzzled for a while, and we weren’t sure if there was a tool to help us pinpoint the problem.

After several hours of investigation, we finally traced the issue back to spring-boot-dependencies:3.1.4.

So, if you ever face a similar problem with Maven’s transitive dependency resolution, keep in mind that it can be a real head-scratcher. And, as we learned, Googling ‘maven transitive dependency version changed’ or ‘maven transitive dependency version resolution’ may not provide the quick answers you’re looking for.