Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is SBT NOT excluding these libraries despite using excludes?

Tags:

sbt

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

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

like image 504
Channing Walton Avatar asked Aug 07 '14 09:08

Channing Walton


2 Answers

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.

like image 119
Thomas Lockney Avatar answered Oct 19 '22 15:10

Thomas Lockney


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")))
like image 24
thirstycrow Avatar answered Oct 19 '22 14:10

thirstycrow