Question: why does he ignore MergeStrategy.first?
I made a small application in the Play Framework using version 2.3.8. According to the official documentation, you can add the addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.12.0") line addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.12.0") to plugin.sbt and add a few (see Code below) to use the activator assembly command.
This seems to work, but there is a conflict with deduplication. This happens strangely with the ServerWithStop.class file. In build.sbt there is a MergeStrategy assembly for this class. This is an exact copy of the official documentation.
case "play/core/server/ServerWithStop.class" => MergeStrategy.first case other => (assemblyMergeStrategy in assembly).value(other)
I added a few lines that I found to fix spring.tooling deduplicators (which can be found again in full sbt). I understand the principles; its hashing SHA-1 to compare classes, then merging according to the behavior, I understand that it does not understand what to do with duplicates that seem to be different from ServerWithStop.class.
What I don't understand (and therefore the question): why does he ignore MergeStrategy.first?
-
build.sbt
name := """MovieRequest""" version := "1.0" lazy val root = (project in file(".")).enablePlugins(PlayJava) scalaVersion := "2.11.1" libraryDependencies ++= Seq( javaJdbc, javaEbean, cache, javaWs, "mysql" % "mysql-connector-java" % "5.1.35" ) mainClass in assembly := Some("play.core.server.NettyServer") fullClasspath in assembly += Attributed.blank(PlayKeys.playPackageAssets.value) assemblyExcludedJars in assembly <<= (fullClasspath in assembly) map { cp => cp filter {x => x.data.getName.matches("sbt.*") || x.data.getName.matches(".*macros.*")} } // Exclude commons-logging because it conflicts with the jcl-over-slf4j libraryDependencies ~= { _ map { case m if m.organization == "com.typesafe.play" => m.exclude("commons-logging", "commons-logging") case m => m }} assemblyMergeStrategy in assembly := { case x if Assembly.isConfigFile(x) => MergeStrategy.concat case PathList(ps @ _*) if Assembly.isReadme(ps.last) || Assembly.isLicenseFile(ps.last) => MergeStrategy.rename case PathList("META-INF", xs @ _*) => (xs map {_.toLowerCase}) match { case ("manifest.mf" :: Nil) | ("index.list" :: Nil) | ("dependencies" :: Nil) => MergeStrategy.discard case ps @ (x :: xs) if ps.last.endsWith(".sf") || ps.last.endsWith(".dsa") => MergeStrategy.discard case "plexus" :: xs => MergeStrategy.discard case "spring.tooling" :: xs => MergeStrategy.discard case "services" :: xs => MergeStrategy.filterDistinctLines case ("spring.schemas" :: Nil) | ("spring.handlers" :: Nil) => MergeStrategy.filterDistinctLines case _ => MergeStrategy.deduplicate } case "asm-license.txt" | "overview.html" => MergeStrategy.discard // Take the first ServerWithStop because it packaged into two jars case "play/core/server/ServerWithStop.class" => MergeStrategy.first case other => (assemblyMergeStrategy in assembly).value(other) }
Frak
source share