How do you exclude a transitive project dependency in gradle

守給你的承諾、 提交于 2019-12-04 17:42:08

问题


given

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

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?


回答1:


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
    }
} 


来源:https://stackoverflow.com/questions/13923516/how-do-you-exclude-a-transitive-project-dependency-in-gradle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!