playframework - Play Java 2.3.8 deduplicate on sbt-assembly -
the question: why ignoring mergestrategy.first?
i've made minor application within play framework using version 2.3.8 according official documentation can add line addsbtplugin("com.eed3si9n" % "sbt-assembly" % "0.12.0")
to plugin.sbt , add few (see code below) use activator assembly
command.
this seems working there deduplicate conflict. happens strangely file serverwithstop.class. in build.sbt there assemblemergestrategy class. exact copy of official documentation.
case "play/core/server/serverwithstop.class" => mergestrategy.first case other => (assemblymergestrategy in assembly).value(other)
i've added few lines found fix spring.tooling deduplicates (which can found again in full sbt). understand principles; hashing sha-1 compare classes merge according behaviour, understand doesn't understand duplicates seem different serverwithstop.class.
what dont understand (and question): why ignoring 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 conflicts 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 first serverwithstop because it's packaged 2 jars case "play/core/server/serverwithstop.class" => mergestrategy.first case other => (assemblymergestrategy in assembly).value(other) }
Comments
Post a Comment