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

Whenever I call gradlew dependencies in a gradle project, I get a list of all the configuration dependencies (which when setting up only compilation usually include the same thing repeated many times for the runtime, test and testRuntime).

Can I specify a specific configuration for viewing dependencies?

+8
source share
2 answers

If you also want to filter modulo you can use the following command:

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

For example, if you want to display all the dependency graphs, use:

 gradlew dependencies 

For example, if you want to display all the dependency graphs for the lib module, use:

 gradlew -p lib dependencies 

If you want to infer compilation dependencies for a debug option:

 gradlew dependencies --configuration debugCompileClasspath 

If you want to output runtime dependencies for the debug option:

 gradlew dependencies --configuration debugRuntimeClasspath 

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

 gradlew -p lib dependencies --configuration productionDebugRuntimeClasspath 
+5
source

Command: gradle[w] dependencies --configuration <configuration_name>

In my case, I only want to see the compilation of the configuration, so I would type:

 gradlew dependencies --configuration compile 
+12
source

Source: https://habr.com/ru/post/971629/


All Articles