Disable transitive-dep inclusion in ShadeRule.keep
I have a library with classes in package x.y.z that I would like to publish to Maven Central for use by other libraries.
It uses Guava 16.0.1, which conflicts with Spark's/Hadoop's Guava version, so I'd like to shade+rename Guava into the JAR I publish.
I'm having trouble configuring sbt-assembly to give me an assembled JAR with just my classes (x.y.z.**) as well as Guava (relocated in as x.y.z.guava.**).
My two attempts have been:
assemblyShadeRules in assembly := Seq(
ShadeRule.keep("com.google.common.collect.**").inAll,
ShadeRule.rename(
"com.google.common.**" -> "x.y.z.guava.@1"
).inAll
)
and
assemblyShadeRules in assembly := Seq(
ShadeRule.keep("x.y.z.**").inAll,
ShadeRule.keep("com.google.common.collect.**").inAll,
ShadeRule.rename(
"com.google.common.**" -> "x.y.z.guava.@1"
).inAll
)
The first one doesn't contain my library's classes (x.y.z.**), but the latter treats x.y.z.** as a "root" and the assembled JAR ends up with all of my dependencies shaded, since they are used by classes in x.y.z.**.
Is there a way to disable the transitive-dep-inclusion behavior of ShadeRule.keep, so that I get just my x.y.z.** classes and renamed-guava in my assembled JAR?
Thanks!