我在sbt的IDE中遇到了一个奇怪的错误,合并策略如下,
mergeStrategy in assembly <<= (mergeStrategy in assembly) { (old) =>
{
case m if m.toLowerCase.endsWith("manifest.mf") => MergeStrategy.discard
case m if m.startsWith("META-INF") => MergeStrategy.discard
case PathList("javax", "servlet", xs @ _*) => MergeStrategy.first
case PathList("org", "apache", xs @ _*) => MergeStrategy.first
case PathList("org", "jboss", xs @ _*) => MergeStrategy.first
case "about.html" => MergeStrategy.rename
case "reference.conf" => MergeStrategy.concat
case _ => MergeStrategy.first
}
}
看起来很好,但不幸的是,IDE抱怨一个错误,它是
Cannot resolve reference <<= with such signature
Type mismatch,expected:Def.Initialize[(String) => Plugin.MergeStrategy],
actual:Def.Initialize[Any].
任何人都可以向我解释这个问题以及如何解决这个问题?
答案 0 :(得分:1)
mergeStrategy
(以及<<=
运算符)已弃用。请改用assemblyMergeStrategy
:
assemblyMergeStrategy in assembly := {
case m if m.toLowerCase.endsWith("manifest.mf") => MergeStrategy.discard
case m if m.startsWith("META-INF") => MergeStrategy.discard
case PathList("javax", "servlet", xs@_*) => MergeStrategy.first
case PathList("org", "apache", xs@_*) => MergeStrategy.first
case PathList("org", "jboss", xs@_*) => MergeStrategy.first
case "about.html" => MergeStrategy.rename
case "reference.conf" => MergeStrategy.concat
case s => MergeStrategy.defaultMergeStrategy(s)
}