Gradle,如何禁用所有传递依赖关系 [英] Gradle, How To Disable All Transitive Dependencies

查看:971
本文介绍了Gradle,如何禁用所有传递依赖关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的许多罐子有冲突的传递依赖(多个弹簧版本)。我想通过明确管理我的所有依赖项来避免继承的版本冲突,是否可以禁用Gradle中的所有传递依赖项?



我知道我可以向我的每个依赖项添加 transitive = false ,但我希望有一个更简单方式。

  compile(group:'org.springframework',name:'spring',version:'2.5.2') {
transitive = false
}


解决方案

p>我最后使用:

  configurations.all {
transitive = false
}


Many of my jars have conflicting transitive dependencies (multiple spring versions). I would like to avoid inherited version conflicts by managing all of my dependencies explicitly, is it possible to disable all transitive dependencies in Gradle?

I know I can add transitive = false to each of my dependencies, but I am hoping there is a simpler way.

compile(group: 'org.springframework', name: 'spring', version: '2.5.2') {
    transitive = false
}

解决方案

I ended up using:

configurations.all {
    transitive = false
}

这篇关于Gradle,如何禁用所有传递依赖关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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