简体   繁体   English

请参阅gradle中的单个配置的依赖关系树(使用`dependencies`任务)

[英]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). 每当我在gradle项目上调用gradlew dependencies时,我会得到每个配置的依赖项列表(当只配置编译时,通常包括为运行时,test和testRuntime重复多次的相同事务)。

Is there a way to specify a particular configuration to view the dependencies of? 有没有办法指定特定的配置来查看依赖关系?

The command is: gradle[w] dependencies --configuration <configuration_name> 命令是: 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: 因此,例如,如果要输出lib模块的所有依赖关系图,请使用:

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: 如果要在lib模块中输出调试变量和生产风格的运行时依赖性:

gradlew -p lib dependencies --configuration productionDebugRuntimeClasspath

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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