问题描述
我有一个使用 spring-ws-security
的项目。
这引入了 EH 缓存,它并不是真正需要的(所以我不确定为什么 spring-ws-security
将它声明为非可选,但这是另一回事)。
但 Apache WSS4J 也将其引入。
+--- org.springframework.ws:spring-ws-security -> 3.0.10.RELEASE
...
| +--- net.sf.ehcache:ehcache:2.10.5 -> 2.10.6 ...
...
| +--- org.apache.wss4j:wss4j-ws-security-dom:2.2.3 -> 2.2.2
...
| | \--- net.sf.ehcache:ehcache:2.10.5 -> 2.10.6
当我使用
从spring-ws-security
中排除它时
implementation("org.springframework.ws:spring-ws-security") {
exclude group: 'net.sf.ehcache',module: 'ehcache' // Not needed,contains a security vulnerability
}
,我希望它真正排除它。但既然我们在谈论 Gradle,it has a head of it's own。这意味着如果一个子部门带来它,它就会保留它。
所以我试图将它从子dep中排除:
// Because of Gradle's logic,sub-deps can bring the excluded dep back.
implementation("org.apache.wss4j:wss4j-ws-security-dom") {
exclude group: 'net.sf.ehcache',module: 'ehcache'
}
但这并没有帮助,我仍然可以在依赖树中看到它。
我可以在全局范围内排除它,但我不想这样做,因为这是一种不好的做法,并且以后当其他一些库非可选地需要 EH 缓存时可能会导致问题:
configurations.all {
exclude group:"some.group",module: "module-to-exclude"
}
有什么方法可以让 Gradle 从我要求它排除的整个子树中排除一个依赖项吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)