如何在渐变中排除传递性项目依赖 [英] How do you exclude a transitive project dependency in gradle

查看:194
本文介绍了如何在渐变中排除传递性项目依赖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

给定

dependencies {
   compile project(':subproject') {
        transitive = false
   }
}

这在gradle 1.3中无法正常工作。 (即所有依赖项都包含在子项目中)

This does not work properly in gradle 1.3. (i.e. all dependencies are included from the subproject)

这是一个错误,还是有不同的语法排除项目依赖关系?

Is this a bug or is there a different syntax for excluding project dependencies?

推荐答案

显示的语法将添加一个新的(所谓的动态传递属性到 Project 对象,除非在其他地方使用,否则不会有任何影响。您会收到一个警告,指出动态属性已被弃用,这是构建脚本中潜在错误的一个迹象,并且将在Gradle 2.0中失败。

The shown syntax will add a new (so-called dynamic) transitive property to the Project object, which, unless used somewhere else, won't have any effect. You'll get a warning that dynamic properties have been deprecated, which is a sign of a potential mistake in the build script, and will fail hard in Gradle 2.0.

正确的语法是(如您已经指出的):

The correct syntax is (as you already indicated):

dependencies {
    compile(project(':subproject')) {
        transitive = false
    }
} 

这篇关于如何在渐变中排除传递性项目依赖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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