Why is SBT NOT excluding these libraries despite using excludes?

后端 未结 2 1264
予麋鹿
予麋鹿 2021-02-20 09:11

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

\"net.liftweb\" %% \"lift-mapper\" % \"2.6-M4\" % \"compile\" excludeAll(ExclusionRule(\"net.l         


        
2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-20 09:34

    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"))
    

    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.

提交回复
热议问题