Gradle dependency tree not making sense

Hi there,

I’m Ronald, the creator of JobRunr and JobRunr Pro.

I recently did some upgrades of dependencies including JUnit. I moved from JUnit 5.10.0 to 5.10.1 but it included a breaking change regarding inheritance. See the github issue for more info: JUnit 5.10.1 breaks inheritance when using @Disabled · Issue #3600 · junit-team/junit5 · GitHub.

I then tried downgrading JUnit again but it keeps using 5.10.1. If I do a ./gradlew -q core:dependencies --configuration testRuntimeClasspath I get the following output:

+--- project :platform
|    +--- org.slf4j:slf4j-api:2.0.9 (c)
|    +--- (other dependencies unrelated to junit / I am sure about indentation below, so junit-jupiter is a direct child from platform)
+--- org.junit.jupiter:junit-jupiter -> 5.10.1
|    +--- org.junit:junit-bom:5.10.1
|    |    +--- org.junit.jupiter:junit-jupiter:5.10.1 (c)
|    |    +--- org.junit.jupiter:junit-jupiter-api:5.10.1 (c)
|    |    +--- org.junit.jupiter:junit-jupiter-engine:5.10.1 (c)
|    |    +--- org.junit.jupiter:junit-jupiter-params:5.10.1 (c)
|    |    +--- org.junit.platform:junit-platform-commons:1.10.1 (c)
|    |    \--- org.junit.platform:junit-platform-engine:1.10.1 (c)
|    +--- org.junit.jupiter:junit-jupiter-api:5.10.1
|    |    +--- org.junit:junit-bom:5.10.1 (*)
|    |    +--- org.opentest4j:opentest4j:1.3.0
|    |    \--- org.junit.platform:junit-platform-commons:1.10.1
|    |         \--- org.junit:junit-bom:5.10.1 (*)
|    +--- org.junit.jupiter:junit-jupiter-params:5.10.1
|    |    +--- org.junit:junit-bom:5.10.1 (*)
|    |    \--- org.junit.jupiter:junit-jupiter-api:5.10.1 (*)
|    \--- org.junit.jupiter:junit-jupiter-engine:5.10.1
|         +--- org.junit:junit-bom:5.10.1 (*)
|         +--- org.junit.platform:junit-platform-engine:1.10.1
|         |    +--- org.junit:junit-bom:5.10.1 (*)
|         |    +--- org.opentest4j:opentest4j:1.3.0
|         |    \--- org.junit.platform:junit-platform-commons:1.10.1 (*)
|         \--- org.junit.jupiter:junit-jupiter-api:5.10.1 (*)

And my build.gradle is as follows:

api 'org.junit.jupiter:junit-jupiter:5.10.0' //see https://github.com/junit-team/junit5/issues/3600

So, currently, I do not understand why it is using 5.10.1. I went to each pom on mvnrepository.com that may have a dependency to junit-jupiter:5.10.1 (e.g. 'org.mockito:mockito-junit-jupiter' from v5.8 to v5.7) and downgraded them all to try to fix my build, no luck.

I then tried to set the version strictly as mentioned in the docs using the below:

testImplementation('org.junit.jupiter:junit-jupiter') {
    version {
        strictly '5.10.0' //see https://github.com/junit-team/junit5/issues/3600
    }
}

This results in the following dependency tree:

+--- project :platform
|    +--- org.slf4j:slf4j-api:2.0.9 (c)
|    +--- (other dependencies unrelated to junit / I am sure about indentation below, so junit-jupiter is a direct child from platform)
+--- org.junit.jupiter:junit-jupiter:{strictly 5.10.0} -> 5.10.0
|    +--- org.junit:junit-bom:5.10.0 -> 5.10.1
|    |    +--- org.junit.jupiter:junit-jupiter:5.10.1 -> 5.10.0 (c)
|    |    +--- org.junit.jupiter:junit-jupiter-api:5.10.1 (c)
|    |    +--- org.junit.jupiter:junit-jupiter-engine:5.10.1 (c)
|    |    +--- org.junit.jupiter:junit-jupiter-params:5.10.1 (c)
|    |    +--- org.junit.platform:junit-platform-commons:1.10.1 (c)
|    |    \--- org.junit.platform:junit-platform-engine:1.10.1 (c)
|    +--- org.junit.jupiter:junit-jupiter-api:5.10.0 -> 5.10.1
|    |    +--- org.junit:junit-bom:5.10.1 (*)
|    |    +--- org.opentest4j:opentest4j:1.3.0
|    |    \--- org.junit.platform:junit-platform-commons:1.10.1
|    |         \--- org.junit:junit-bom:5.10.1 (*)
|    +--- org.junit.jupiter:junit-jupiter-params:5.10.0 -> 5.10.1
|    |    +--- org.junit:junit-bom:5.10.1 (*)
|    |    \--- org.junit.jupiter:junit-jupiter-api:5.10.1 (*)
|    \--- org.junit.jupiter:junit-jupiter-engine:5.10.0 -> 5.10.1
|         +--- org.junit:junit-bom:5.10.1 (*)
|         +--- org.junit.platform:junit-platform-engine:1.10.1
|         |    +--- org.junit:junit-bom:5.10.1 (*)
|         |    +--- org.opentest4j:opentest4j:1.3.0
|         |    \--- org.junit.platform:junit-platform-commons:1.10.1 (*)
|         \--- org.junit.jupiter:junit-jupiter-api:5.10.1 (*)

I also tried to set a strict verion on org.junit:junit-bom:5.10.1, no luck. All the other configurations (e.g. testFixturesRuntimeClasspath) have org.junit.jupiter:junit-jupiter:5.10.0

Currently, I’m in a state I have not been before: I can’t fix the damn build :rofl:.

Can you maybe share a build --scan, it usually contains pretty good information where things come from.

Thanks, I didn’t know yet it was so easy to use build scans.

Yesterday evening, I finally found the culprit: archunit has a depenceny on junit-platform-engine:1.10.1 which then includes the bom of junit:5.10.1.

The good thing: I’m now officially a licensed detective :partying_face:.

1 Like