尽管使用了排除,为什么 SBT 不排除这些库? [英] Why is SBT NOT excluding these libraries despite using excludes?

查看:19
本文介绍了尽管使用了排除,为什么 SBT 不排除这些库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尽管做了以下操作,sbt 仍然在抓取lift-json.为什么?

Despite doing the following, sbt is still grabbing lift-json. Why?

"net.liftweb" %% "lift-mapper" % "2.6-M4" % "compile" excludeAll(ExclusionRule("net.liftweb", "lift-json"))

更多信息.这是依赖树显示的内容:

More info. This is what dependency tree shows:

+-net.liftweb:lift-mapper_2.10:2.6-M4
[info]   | +-net.liftweb:lift-db_2.10:2.6-M4
[info]   | | +-net.liftweb:lift-util_2.10:2.6-M4
[info]   | | | | 
…
[info]   | | | |   
[info]   | | | +-net.liftweb:lift-json_2.10:2.6-M4

所以依赖是lift-mapper->lift-db->lift-util->lift-json,可能排除不深?

So dependency is lift-mapper -> lift-db -> lift-util -> lift-json, perhaps exclusion is not deep?

推荐答案

这里不明显的关键是 sbt 中的排除实际上只是底层 Ivy 引擎的传递规则.由于 Ivy 对 sbt 约定一无所知(例如,将 _2.10 附加到特定于 Scala 版本的依赖项),您需要告诉它它真正应该排除什么.在这种情况下,这意味着该行应如下所示:

The key thing here that's not obvious is that exclusions in sbt are really just pass-through rules for the underlying Ivy engine. Since Ivy knows nothing about sbt conventions (for instance, appending _2.10 to dependencies that are Scala release specific), you need to tell it what it should really be excluding. In this case, that means the line should look like this:

"net.liftweb" %% "lift-mapper" % "2.6-M4" % "compile" excludeAll(ExclusionRule("net.liftweb", "lift-json_2.10"))

也许可以对 sbt 进行一些增强以使其看到由于您定义的依赖项是特定于 Scala 版本的,因此它还应该尝试为该版本添加排除规则.

Perhaps there is some enhancement that can be made to sbt to allow it to see that since the dependency you've defined is Scala release specific, it should also try adding the exclusion rule for that release, as well.

这篇关于尽管使用了排除,为什么 SBT 不排除这些库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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