I know that Gradle has the excellent dependencies
task that lists out all dependencies for a project. However, it returns them in a tree listing.
I would like to get a list of all my dependencies as they are resolved in just a flat list. Similar to how the Maven dependency plugin list
goal behaves.
You can flatten the deps tree using sed|sort|uniq in linux or cygwin:
$ gradle dependencies | sed 's/^.* //' | sort | uniq
Thanks for the answers already supplied.
Finally I complete it by a more standard way:
project.gradle.addListener(new DependencyResolutionListener() {
@Override
void beforeResolve(ResolvableDependencies dependencies) {}
@Override
void afterResolve(ResolvableDependencies dependencies) {
dependencies.resolutionResult.allComponents.each { select ->
println "selected component: ${select} " + select.selectionReason
}
}
})
Project implementation
will also be resolved in this way, and the final selected component version will be resolved correctly.
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