Why is SBT NOT excluding these libraries despite using excludes?

后端 未结 2 1292
予麋鹿
予麋鹿 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条回答
  • 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.

    0 讨论(0)
  • 2021-02-20 09:45

    Perhaps there are some other libraries depend on it. You can find those libs by using the sbt-dependency-graph plugin. Or simply exclude it from all the dependencies:

    libraryDependencies ++= Seq(
      ......
    ).map(_.excludeAll(ExclusionRule("net.liftweb", "lift-json")))
    
    0 讨论(0)
提交回复
热议问题