Search code examples
sbtsbt-assembly

Sbt Uber Jar assemblyMergeStrategy


I am building a tool that I will deploy in an Uber jar using addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.6")

The merge strategies confuse me. (see https://github.com/sbt/sbt-assembly). Rather than specifying which version of duplicate dependencies to keep (or instructing to keep latest version), the compiler picks which to keep or discard based on position in the CP.

Based on previous experience, this seems to invite problems. How do I specify which version of, say, Jackson or Slf4j I want to keep?


Solution

  • If you just want to pick a version, use dependencyOverrides. You can also inspect version conflicts via show evicted command. See here for a related answer.