I read this comment in the Gradle docs:
To deal with problems due to version conflicts, reports with dependency graphs
are also very helpful. Such reports are another feature of dependency management.
I have some kind of jar being brought in but I need to figure out where it is coming from. Normally I would just globally exclude it, but I need some information on the hierarchy here. How do I get this information like I can from Ivy and Maven?
NOT to mention that someone is bringing Hibernate jars (a lot) in to my jar list and I really want to know who since I am not using Hibernate and try to cut out that dependency.
This question is related to
gradle
For those looking to debug gradle dependencies in react-native
projects, the command is (executed from projectname/android
)
./gradlew app:dependencies --configuration compile
If you got a lot configurations the output might be pretty lengthy. To just show dependencies for the runtime configuration, run
gradle dependencies --configuration runtime
gradlew -q :app:dependencies > dependencies.txt
Will write all dependencies to the file dependencies.txt
If you want recursive to include subprojects, you can always write it yourself:
Paste into the top-level build.gradle
:
task allDeps << {
println "All Dependencies:"
allprojects.each { p ->
println()
println " $p.name ".center( 60, '*' )
println()
p.configurations.all.findAll { !it.allDependencies.empty }.each { c ->
println " ${c.name} ".center( 60, '-' )
c.allDependencies.each { dep ->
println "$dep.group:$dep.name:$dep.version"
}
println "-" * 60
}
}
}
Run with:
gradle allDeps
If you want to see dependencies on project and all subprojects use in your top-level build.gradle:
subprojects {
task listAllDependencies(type: DependencyReportTask) {}
}
Then call gradle:
gradle listAllDependencies
Ah, since I had no dependencies in my master project, "gradle dependencies" only lists those and not subproject dependencies so the correct command ended up being
gradle :<subproject>:dependencies
so for me this was
gradle :master:dependencies
In recent versions of Gradle (ie. 5+), if you run your build with the --scan
flag, it tells you all kinds of useful information, including dependencies, in a browser where you can click around.
gradlew --scan clean build
It will analyze the crap out of what's going on in that build. It's pretty neat.
Source: Stackoverflow.com