This Gradle plugin reads the Gradle dependencies of a given Gradle project, and generates a dependency tree. This package was developed by JFrog, and is used by the JFrog IntelliJ IDEA Plugin to generate the dependency tree for projects using Gradle dependencies. You may find this plugin useful for other purposes and applications as well, by applying it in your build.gradle file.
Inject the plugin using the init.gradle initialization script, and run generateDepTrees in a
directory containing a build.gradle file. The plugin will generate a dependency tree for each subproject that does not
contain a build.gradle file. To generate a dependency tree for each subproject that contains a Gradle build file, set the -Dcom.jfrog.includeAllBuildFiles flag to true.
To skip Gradle configurations whose names match a regex, set
-Dcom.jfrog.excludeConfigurationsPattern=<regex>. For example, to skip names containing
test case-insensitively (including testImplementation, androidTest*, and also
testFixtures* / accidental substring hits like latestReleaseApi):
gradle clean generateDepTrees -I <path/to/init.gradle> -q \
-Dcom.jfrog.depsTreeOutputFile=<path/to/output/file> \
-Dcom.jfrog.excludeConfigurationsPattern=(?i)testIf the property is omitted or blank, all configurations are included. Invalid regex fails the task.
The command:
gradle clean generateDepTrees -I <path/to/init.gradle> -q -Dcom.jfrog.depsTreeOutputFile=<path/to/output/file>Output:
"<path/to/dependency/tree1>"
"<path/to/dependency/tree2>"
...
{
"root": "org.jfrog.example.gradle:shared:1.0-SNAPSHOT",
"nodes": {
"junit:junit:4.7": {
"unresolved": false,
"configurations": ["testCompileClasspath", "testImplementation", "testRuntimeClasspath"],
"types": ["jar"],
"children": []
},
"org.jfrog.example.gradle:shared:1.0-SNAPSHOT": {
"unresolved": false,
"configurations": ["compileClasspath", "runtimeClasspath", "testCompileClasspath", "testRuntimeClasspath"],
"types": [],
"children": ["junit:junit:4.7"]
}
}
}types lists the artifact type(s) a dependency resolved as ("jar", or "pom" for a BOM). May be empty if undetermined. Downstream consumers should ignore unrecognized values.
We welcome pull requests from the community. To help us improve this project, please read our contribution guide.