If you want to visualize your dependencies in a graph you can use gradle-dependency-graph-generator plugin. Generally the output of this plugin can be found in build/reports/dependency-graph directory and it contains three files (. dot|. png|.
In Gradle dependencies are libraries required to build your code. Each of these libraries may have their own dependencies, adding transitive dependencies to your project. This structure is called the Gradle dependency tree, with its own rules on dependency conflict resolution and more.
The command is gradle dependencies
, and its output is much improved in Gradle 1.2. (You can already try 1.2-rc-1 today.)
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
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
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
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
gradlew -q :app:dependencies > dependencies.txt
Will write all dependencies to the file dependencies.txt
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 love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With