Reputation: 17
How do packaging a jar by selected scala classes using SBT assembly. While using SBT full project is created as jar. Is there a way to exclude the classes? Please help .
Upvotes: 0
Views: 275
Reputation: 14217
You can use assemblyMergeStrategy
with MergeStrategy.discard
to discard to the classes that you want, like:
assemblyMergeStrategy in assembly := {
case PathList("javax", "servlet", xs @ _*) => MergeStrategy.first
case PathList(ps @ _*) if ps.last endsWith ".html" => MergeStrategy.first
case "application.conf" => MergeStrategy.concat
case "unwanted.txt" => MergeStrategy.discard
case x =>
val oldStrategy = (assemblyMergeStrategy in assembly).value
oldStrategy(x)
}
Reference:
https://github.com/sbt/sbt-assembly#merge-strategy
Upvotes: 1