我正在尝试使用SBT程序集插件创建一个可执行jar。
我最终得到以下错误:
[error] (app/*:assembly) deduplicate: different file contents found in the following:
[error] /Users/rajeevprasanna/.ivy2/cache/org.eclipse.jetty.orbit/javax.servlet/orbits/javax.servlet-3.0.0.v201112011016.jar:about.html
[error] /Users/rajeevprasanna/.ivy2/cache/org.eclipse.jetty/jetty-continuation/jars/jetty-continuation-8.1.8.v20121106.jar:about.html
[error] /Users/rajeevprasanna/.ivy2/cache/org.eclipse.jetty/jetty-http/jars/jetty-http-8.1.8.v20121106.jar:about.html
[error] /Users/rajeevprasanna/.ivy2/cache/org.eclipse.jetty/jetty-io/jars/jetty-io-8.1.8.v20121106.jar:about.html
[error] /Users/rajeevprasanna/.ivy2/cache/org.eclipse.jetty/jetty-security/jars/jetty-security-8.1.8.v20121106.jar:about.html
[error] /Users/rajeevprasanna/.ivy2/cache/org.eclipse.jetty/jetty-server/jars/jetty-server-8.1.8.v20121106.jar:about.html
[error] /Users/rajeevprasanna/.ivy2/cache/org.eclipse.jetty/jetty-servlet/jars/jetty-servlet-8.1.8.v20121106.jar:about.html
[error] /Users/rajeevprasanna/.ivy2/cache/org.eclipse.jetty/jetty-util/jars/jetty-util-8.1.8.v20121106.jar:about.html
[error] /Users/rajeevprasanna/.ivy2/cache/org.eclipse.jetty/jetty-webapp/jars/jetty-webapp-8.1.8.v20121106.jar:about.html
[error] /Users/rajeevprasanna/.ivy2/cache/org.eclipse.jetty/jetty-xml/jars/jetty-xml-8.1.8.v20121106.jar:about.html
[error] Total time: 2562 s, completed Dec 5, 2013 12:03:25 PM
在阅读了程序集插件的wiki后,我在build.scala文件中添加了合并策略。似乎它不起作用。我不确定它是否正确修复。有人可以建议我正确的策略。
以下是我在build.scala文件中的代码:
mergeStrategy in assembly <<= (mergeStrategy in assembly) {
(old) => {
case "about.html" => MergeStrategy.discard
case "logback.xml" => MergeStrategy.first //case PathList("logback.xml") => MergeStrategy.discard
case x => old(x)
}
}
我根据此文档编译了与我的应用程序的插件集成:Standalone deployment of Scalatra servlet
我尝试了不同的策略,如MergeStrategy.rename和MergeStrategy.deduplicate。但没有任何作用.. 寻求帮助......
答案 0 :(得分:1)
您的MergeStrategy
看起来是正确的。唯一未处理的冲突是jetty罐中的“about.html”,所以case "about.html" => MergeStrategy.discard
应该这样做。
如果您仍然收到错误,我怀疑mergeStrategy in assembly
设置的重新连接要么没有进入,要么进入错误的顺序。确切知道的唯一方法是看看你的Build.scala。例如,@ Stefan Ollinger对您链接问题的回答将项目设置如下:
lazy val project = Project("myProj", file(".")).
settings(mySettings: _*).
settings(myAssemblySettings:_*)
如果可能,您可以在gist上发布Build.scala吗?