简体   繁体   中英

See dependency tree for single configuration in gradle (using `dependencies` task)

Whenever I call gradlew dependencies on a gradle project, I get a list of every configuration's dependencies (which when only compile is configured, usually includes the same thing repeated several times for runtime, test and testRuntime).

Is there a way to specify a particular configuration to view the dependencies of?

The command is: gradle[w] dependencies --configuration <configuration_name>

In my case, I want to see just compile configuration so I would type:

gradlew dependencies --configuration compile

If you want to filter by module as well, you can use the following command:

gradlew -p <module-name> dependencies --configuration <configuration-name>

So for example, if you want to output all dependency graphs use:

gradlew dependencies

So for example, if you want to output all dependency graphs for a lib module use:

gradlew -p lib dependencies

If you want to output compile dependencies for debug variant:

gradlew dependencies --configuration debugCompileClasspath

If you want to output runtime dependencies for debug variant:

gradlew dependencies --configuration debugRuntimeClasspath

If you want to output runtime dependencies for debug variant and production flavor in the lib module:

gradlew -p lib dependencies --configuration productionDebugRuntimeClasspath

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM