My assemblyMergeStrategy in built.sbt (sbt 0.13.x, sbt assembly 0.14.5) looks like below
assemblyMergeStrategy in assembly := {
case PathList("META-INF", xs @_*) => MergeStrategy.filterDistinctLines
case "reference.conf" => MergeStrategy.concat
case x@_ => MergeStrategy.first
}
where I want files under META-INF get merged without duplicate values.
However, checking assembled jar file (by unzip) shows that files under META-INF/services folder are not picked up because it’s empty.
Is the above code the right way to merge files that share the same name into single one without duplicate values? For instance I have two files shared the same name called io.dropwizard.metrics.ReporterFactory
. One of them contains content https://github.com/dropwizard/dropwizard/blob/master/dropwizard-metrics/src/main/resources/META-INF/services/io.dropwizard.metrics.ReporterFactory while the other with custom content e.g. a.b.c.MyReporterFactory
. I expect using MergeStrategy.filterDistinctLines should merge two files io.dropwizard.metrics.ReporterFactory
content into
io.dropwizard.metrics.ConsoleReporterFactory
io.dropwizard.metrics.CsvReporterFactory
io.dropwizard.metrics.Slf4jReporterFactory
a.b.c.MyReporterFactory
Is this correct expectation? If not what’s the correct way to achieve the above effect - i.e. merge the content in multiple files, that share the same name, without duplication into a single file?
Thanks