从子项目类路径中排除父项目依赖项 [英] Exclude parent project dependencies from child project classpath
本文介绍了从子项目类路径中排除父项目依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个父项目,该项目为其所有子项目定义了对某些本地库的依赖:
I have parent project that defines dependency on some local libraries for all its child projects:
subprojects {
dependencies {
compile fileTree(dir: '../somelib', include: '*.jar')
}
}
我可以在不触摸父级 build.gradle
的情况下从子项目中父级的依赖项中排除某些jar(甚至整个库文件夹)吗?
Can I exclude some jars (or even whole library folder) from parent's dependencies in child project without touching parent build.gradle
?
推荐答案
也许这对您有所帮助.将此添加到您孩子的项目build.gradle
Maybe this helps you. Add this in your child's project build.gradle
configurations {
all.collect { configuration ->
configuration.exclude group: 'org.springframework.ws', module: 'spring-ws-core'
}
}
我不得不处理一些spring依赖项,而且,我以这种方式解决了它.虽然我不喜欢它,但是一切都取决于我设置项目的方式.
I had to deal with some spring dependencies, and well, I fixed it that way. I don't like it though, but all comes down to the way I have set up my projects.
这篇关于从子项目类路径中排除父项目依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文