标准做法是使用MergeStrategy.discard
从组合/单/ ueber-jar中删除jar文件中存在的已签名jar条目。以下是build.sbt
的摘录:特别注意引用DSA
的第二个和第三个条目:
mergeStrategy in assembly <<= (mergeStrategy in assembly) { (old) => {
case n if n.startsWith("META-INF/MANIFEST.MF") => MergeStrategy.discard
case n if n.toUpperCase.startsWith("META-INF/.*.DSA") => MergeStrategy.discard
case n if n.toUpperCase.startsWith("META-INF/*.DSA") => MergeStrategy.discard
case n if n.toUpperCase.startsWith("META-INF/ECLIPSEF.RSA") => MergeStrategy.discard
case n if n.toUpperCase.startsWith("META-INF/ECLIPSEF.SF") => MergeStrategy.discard
case x if x.contains("apache") => MergeStrategy.first
case x if x.contains("log") => MergeStrategy.first
case x if x.contains("google") => MergeStrategy.first
case x if x.contains("journal") => MergeStrategy.first
case x if x.contains("slf4j") => MergeStrategy.first
case _ => MergeStrategy.first
}
}
但生成的程序集jar确实包含一些DSA条目:
18:51:20/tmsjobs $jar -tvf memsql/target/scala-2.10/memsql-assembly-1.0.0-SNAPSHOT.jar | egrep "DUMMY|DSA"
1042 Fri Jan 30 22:08:48 PST 2015 META-INF/DUMMY.DSA
36829 Fri Jan 30 22:08:48 PST 2015 META-INF/DUMMY.SF
排除/弃置策略中缺少/不正确的内容是什么? (其次,第2或第3行中的哪一行是正确的格式,即.*.DSA
或*.DSA
。谢谢。