合并策略的行为不符合预期

时间:2012-11-26 17:04:07

标签: sbt sbt-assembly

在build.scala中我有以下内容:

mergeStrategy <<= (mergeStrategy in assembly) {(old) => {
  case PathList("javax", "servlet",  "resources", xs @ _*) => MergeStrategy.first
  case x => old(x)
}}

但是,当我运行assembly时,我看到了:

[info] Merging 'javax/servlet/resources/web-app_2_2.dtd' with strategy 'deduplicate'

显示它正在使用“重复数据删除”策略,而不是“第一”策略。这会出现以下错误:

[error] {file:/home/dan/tesla/}tesla-appengine/*:assembly: deduplicate: different file contents found in the following:
[error] /home/dan/.ivy2/cache/com.google.appengine/appengine-tools-sdk/jars/appengine-tools-sdk-1.7.3.jar:javax/servlet/resources/web-app_2_2.dtd
[error] /home/dan/.ivy2/cache/javax.servlet/servlet-api/jars/servlet-api-2.5.jar:javax/servlet/resources/web-app_2_2.dtd

1 个答案:

答案 0 :(得分:1)

我没有在适当的范围内应用此设置。我需要设置

mergeStrategy in assembly <<= ...