I have a Gradle multi-project build with a master-directory where common definitions are located and some projects that are defined in settings.gradle via include
statements.
Building, testing, runnings all works fine, but showing dependencies via task dependencies
does not work, it only prints:
$ g dependencies
master
:dependencies
------------------------------------------------------------
Root project
------------------------------------------------------------
No configurations
BUILD SUCCESSFUL
Doing gradle :project1:dependencies
in the master-directory works as expected.
How can I get Gradle to print out the whole dependency tree including all the third party libraries for all the projects that are included?
Every Gradle project provides the task dependencies to render the so-called dependency report from the command line. By default the dependency report renders dependencies for all configurations. To focus on the information about one configuration, provide the optional parameter --configuration .
The Gradle dependency cache consists of two storage types located under GRADLE_USER_HOME/caches : A file-based store of downloaded artifacts, including binaries like jars as well as raw downloaded meta-data like POM files and Ivy files.
Gradle stores resolved dependencies in its own cache. A build does not need to declare the local Maven repository even if you resolve dependencies from a Maven-based, remote repository.
Unfortunately, you have to specify your own task:
allprojects {
task printAllDependencies(type: DependencyReportTask) {}
}
And after that, execute: ./gradlew printAllDependencies
.
In case if you don't want to see dependencies for the root project, put this task to the subprojects
block.
subprojects {
task printSubDependencies(type: DependencyReportTask) {}
}
dependencyInsight
task.
subprojects {
task findDependency(type: DependencyInsightReportTask) {}
}
And after that run
./gradlew findDependency --configuration compile --dependency spring-data-jpa
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