Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 253
coderatchet Avatar asked Jul 02 '14 00:07

coderatchet


People also ask

How do you read a Gradle dependency tree?

In Gradle dependencies are libraries required to build your code. Each of these libraries may have their own dependencies, adding transitive dependencies to your project. This structure is called the Gradle dependency tree, with its own rules on dependency conflict resolution and more.

How do I print a Gradle dependency tree?

Right-click on gradle task->"Dependency Tree" to print task dependencies.


1 Answers

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
like image 187
TheIT Avatar answered Nov 14 '22 05:11

TheIT