How to find out the dependency containing another dependency

We are getting an error during a build because a jar file is not found in our artifactory repo but we dont directly add it as a dependency. How do I find out which of our direct dependencies is including that as a dependency?

I tried doing a --write-locks build so that I could find the culprit but it cant get past the error to write the dependencies.lock file

I also tried ./gradlew build --scan and ./gradlew dependencies but both stop when the error happens trying to get the missing jar. Seems like there is no way to find out which of my dependencies is including the offending jar… there has to be a way.

@rickfish1 usual ./gradlew dependencies should still succeed and show you where the problem is in the dependency graph. What error are you seeing when running it?

This is what I get:

$ ./gradlew dependencies
Configuration on demand is an incubating feature.

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring root project ‘conductor-dev’.

Could not resolve all artifacts for configuration ‘:classpath’.
Could not download jackson-databind.jar (com.fasterxml.jackson.core:jackson-databind:2.9.5)
Could not get resource ‘http://artifactory.bcbsfl.com/artifactory/maven-libs/com/fasterxml/jackson/core/jackson-databind/2.9.5/jackson-databind-2.9.5.jar’.
Could not GET ‘http://artifactory.bcbsfl.com/artifactory/maven-libs/com/fasterxml/jackson/core/jackson-databind/2.9.5/jackson-databind-2.9.5.jar’. Received status code 401 from server: Unauthorized

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 4s

‘:classpath’ is the classpath of the build itself (the applied plugins with their dependencies). That explains why you can’t run anything. Gradle already fails during configuring the build.

You can try the buildEnvironment task. Is similar to dependencies but for the classpath of the build.