sbt-assembly:重复数据删除找到不同的文件内容

时间:2017-01-06 09:24:40

标签: scala build sbt

当我运行此sbt json-config clean assembly时,我对sbt有疑问 我收到了这些错误:

[error] (myapp-api/*:assembly) deduplicate: different file contents found in the following:
[error] /home/teaddict/.ivy2/cache/cglib/cglib-nodep/jars/cglib-nodep-2.1_3.jar:asm-license.txt
[error] /home/teaddict/.ivy2/cache/org.mockito/mockito-all/jars/mockito-all-1.10.19.jar:asm-license.txt

我改变了我的Build.scala并尝试了所有选项,但我仍然遇到同样的错误。

assemblyMergeStrategy in assembly <<= (assemblyMergeStrategy in assembly) { (old) =>
  {
    case PathList("net", "sf", "cglib", _ @ _*) => MergeStrategy.discard
    case PathList(ps @ _*) if ps.last.toLowerCase == "asm-license.txt" => MergeStrategy.discard
    case PathList("asm-license.txt") => MergeStrategy.rename
    case PathList("asm-license.txt") => MergeStrategy.discard
    case PathList(ps@_*) if ps.last == "asm-license.txt" => MergeStrategy.discard
    case "asm-license.txt" => MergeStrategy.discard
    case x => old(x)
  }
},

1 个答案:

答案 0 :(得分:0)

解决方案是:

assemblyMergeStrategy in assembly := {
  case PathList("net", "sf", "cglib", ps @ _*) => MergeStrategy.discard
  case "asm-license.txt" => MergeStrategy.discard
  case x =>
    val old = (assemblyMergeStrategy in assembly).value
    old(x)
}