Exclude parent project dependencies from child project classpath

独自空忆成欢 提交于 2021-01-04 09:10:09

问题


I have parent project that defines dependency on some local libraries for all its child projects:

subprojects {
    dependencies {
        compile fileTree(dir: '../somelib', include: '*.jar')
    }
}

Can I exclude some jars (or even whole library folder) from parent's dependencies in child project without touching parent build.gradle?


回答1:


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

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.



来源:https://stackoverflow.com/questions/46311185/exclude-parent-project-dependencies-from-child-project-classpath

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