Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

maven-shade like plugin for SBT

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 ?

like image 907
shim_ Avatar asked Dec 07 '14 18:12

shim_


People also ask

What is Maven Shade plugin used for?

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.

What are SBT plugins?

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).

Where can I find plugins SBT?

Plugins can be installed for all your projects at once by declaring them in $HOME/. sbt/1.0/plugins/ .

What is transformer in maven shade plugin?

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.


1 Answers

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
)
like image 58
Eugene Yokota Avatar answered Sep 19 '22 16:09

Eugene Yokota