在gradle这个,我应该排除所有依赖一个分支下或只是根就够了吗? [英] In gradle, should I exclude all dependencies under a branch or just the root is enough?

查看:285
本文介绍了在gradle这个,我应该排除所有依赖一个分支下或只是根就够了吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我添加下面的自定义任务进入我的的build.gradle 文件,以便打印出依赖的依赖关系。

I've added following custom task into my build.gradle file In order to print out dependencies of a dependency.

// This part is useful for finding conflict resolution(s) between dependencies in order to exclude them.
// You can change the custom value and run following command in terminal:
// ./gradlew passenger-sdk:dependencies --configuration custom
configurations {
    custom
}

dependencies {
    custom 'com.google.android.gms:play-services-analytics:7.3.0'
}

所以结果是:

$ ./gradlew passenger-sdk:dependencies --configuration custom
:passenger-sdk:dependencies

------------------------------------------------------------
Project :passenger-sdk
------------------------------------------------------------

custom
\--- com.google.android.gms:play-services-analytics:7.3.0
     \--- com.google.android.gms:play-services-base:7.3.0
          \--- com.android.support:support-v4:22.0.0
               \--- com.android.support:support-annotations:22.0.0

BUILD SUCCESSFUL

Total time: 1.681 secs

我要排除所有的依赖,因为我有他们。我是否应该排除所有三个依赖播放服务基支持-V4 支持 - 注释或只是播放服务基就足够了?

I want to exclude all of its dependencies since I have them. Should I exclude all three dependencies play-services-base and support-v4 and support-annotations or just play-services-base is enough?

推荐答案

排除播放服务基应该够了。既然你已经排除了父母的依赖,支持-V4 支持的注解将不提供,如果没有更多的依赖于它。

Exclude play-services-base should be enough. Since you've excluded the parent dependency, support-v4 and support-annotations will not be provided, if nothing more depends on it.

如果有一些更多的依赖关系,这需要有支持-V4 支持的注解为同一配置,那么你必须额外排除它们,但它可以一次全部配置完成。

If there are some more dependencies, which need to have support-v4 and support-annotations for the same configuration, then you have to exclude them additionally, but it could be done once for whole configuration.

这篇关于在gradle这个,我应该排除所有依赖一个分支下或只是根就够了吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆