Reputation: 867
I have a project for which I have to include a fat-jar for some proprietary hardware - don't ask, I know its best for the jar to be on Central or some other repo, but it is not. :( I have to put it in the lib directory so sbt would treat it as an unmanaged dependency.
but the jar includes slf4j, an old version of it, and when Play! runs it throws an error complaining that a static function is missing (which was added in the newer versions of slf4j.
Here is what I have tried.
Does anyone know of a way to exclude something inside an Uber jar that is an unmanaged dependency in an sbt-based scala or play project?
Upvotes: 1
Views: 279
Reputation: 149538
You could shade your managed slf4j library and make it seem as there is no dependency clash. To do this you can use sbt-assembly shading ability.
For example, if you're using slf4j-api
, it would look like this:
assemblyShadeRules in assembly ++= Seq(
ShadeRule.rename("org.slf4j.slf4j-api.**" -> "my_slf4j.@1")
.inLibrary("org.slf4j" % "slf4j-api" % "1.7.21")
.inProject
)
This will cause anything using this specific version of slf4j to alter it's package name with a my_slf4j
prefix instead of org.slf4j
.
Upvotes: 0