i'm rellatively new to the scala and sbt world and i'm trying to manage all my new projects with sbt rather than using maven. But now i'm on a point where I dont know further because I can't find any sbt counterpart for the mavnen-shade plugin. What I found only were plugins to include all dependencies, but that is not what I need. So do somebody know a plugin to include certain dependencies into the jar ?
This plugin provides the capability to package the artifact in an uber-jar, including its dependencies and to shade - i.e. rename - the packages of some of the dependencies.
A plugin can define a sequence of sbt settings that are automatically added to all projects or that are explicitly declared for selected projects. For example, a plugin might add a proguard task and associated (overridable) settings. Finally, a plugin can define new commands (via the commands setting).
Plugins can be installed for all your projects at once by declaring them in $HOME/. sbt/1.0/plugins/ .
Aggregating classes/resources from several artifacts into one uber JAR is straight forward as long as there is no overlap. Otherwise, some kind of logic to merge resources from several JARs is required. This is where resource transformers kick in.
sbt-assembly 0.14.0 adds shading support.
sbt-assembly can shade classes from your projects or from the library dependencies. Backed by Jar Jar Links, bytecode transformation (via ASM) is used to change references to the renamed classes.
assemblyShadeRules in assembly := Seq(
ShadeRule.rename("org.apache.commons.io.**" -> "shadeio.@1").inAll
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With