I work on a Scala + SBT based project.
I am trying to package a the project which contains multiple submodules into a runnable fat-jar. I am using sbt-assembly plugin with the following build.sbt
file:
... Project initializations...
osName := "win"
lazy val javafxVersion = "14"
libraryDependencies ++= Seq(...Managed dependencies...)
assemblyMergeStrategy in assembly := {
case PathList("META-INF", xs@_*) => MergeStrategy.discard
case x => MergeStrategy.first
}
assemblyJarName in assembly := s"${name.value}_${version.value}.jar".replace("-SNAPSHOT", "")
I need the merge strategy above otherwise I get tens of thousands of conflicts. However, when it comes to managed dependencies that are modularized (contain module-info.class)
file, it will pick the first one. This creates a problem as there are 19 dependencies that are actually modularized (JavaFX being an example).
I tried creating my own custom merge strategy but am not an expert when it comes to SBT. I was wondering if there is a better solution to this or am I going to have to create a custom one?
I searched for a while now, I couldn't find a solution, however this GitHub link suggests sbt-assembly doesn't offer a ready-to-go solution for this.