作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用 sbt-assembly 插件构建一个胖 Jar。我使用的是 SBT 版本 0.13.1 和程序集插件版本:0.11.2。
每当我在 sbt 控制台中运行程序集命令时,都会遇到此错误:
更新:
[warn] Merging 'META-INF\LICENSE' with strategy 'rename'
[warn] Merging 'META-INF\DEPENDENCIES' with strategy 'discard'
[warn] Merging 'META-INF\MANIFEST.MF' with strategy 'discard'
[debug] Merging 'META-INF\native\linux32\libleveldbjni.so' with strategy 'deduplicate'
[debug] Merging 'META-INF\native\linux64\libleveldbjni.so' with strategy 'deduplicate'
[debug] Merging 'META-INF\native\osx\libleveldbjni.jnilib' with strategy 'deduplicate'
[debug] Merging 'META-INF\native\windows32\leveldbjni.dll' with strategy 'deduplicate'
[debug] Merging 'META-INF\native\windows64\leveldbjni.dll' with strategy 'deduplicate'
[debug] Merging 'default.key' with strategy 'deduplicate'
java.lang.RuntimeException: deduplicate: different file contents found in the following:
mydef.key
mydef.key
at sbtassembly.Plugin$Assembly$.sbtassembly$Plugin$Assembly$$applyStrategy$1(Plugin.scala:253)
at sbtassembly.Plugin$Assembly$$anonfun$15.apply(Plugin.scala:270)
at sbtassembly.Plugin$Assembly$$anonfun$15.apply(Plugin.scala:267)
at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:251)
at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:251)
at scala.collection.Iterator$class.foreach(Iterator.scala:727)
at scala.collection.AbstractIterator.foreach(Iterator.scala:1157)
at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
at scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:251)
at scala.collection.AbstractTraversable.flatMap(Traversable.scala:105)
at sbtassembly.Plugin$Assembly$.applyStrategies(Plugin.scala:272)
at sbtassembly.Plugin$Assembly$.x$4$lzycompute$1(Plugin.scala:172)
at sbtassembly.Plugin$Assembly$.x$4$1(Plugin.scala:170)
at sbtassembly.Plugin$Assembly$.stratMapping$lzycompute$1(Plugin.scala:170)
at sbtassembly.Plugin$Assembly$.stratMapping$1(Plugin.scala:170)
at sbtassembly.Plugin$Assembly$.inputs$lzycompute$1(Plugin.scala:214)
at sbtassembly.Plugin$Assembly$.inputs$1(Plugin.scala:204)
at sbtassembly.Plugin$Assembly$.apply(Plugin.scala:230)
at sbtassembly.Plugin$Assembly$$anonfun$assemblyTask$1.apply(Plugin.scala:373)
at sbtassembly.Plugin$Assembly$$anonfun$assemblyTask$1.apply(Plugin.scala:370)
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:42)
at sbt.std.Transform$$anon$4.work(System.scala:64)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
at sbt.Execute.work(Execute.scala:244)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:160)
at sbt.CompletionService$$anon$2.call(CompletionService.scala:30)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
[error] (cloud_ui/*:assembly) deduplicate: different file contents found in the following:
[error] mydef.key
[error] mydef.key
**[error](mymodule:*.assembly) deduplicate: different file contents found in the following:
[error] mydef.key
[error] mydef.key**
mergeStrategy in assembly <<= (mergeStrategy in assembly) { (old) =>
{
case PathList("org", "jboss", "netty", xs @ _*) => MergeStrategy.first
case PathList("META-INF", "jboss-beans.xml") => MergeStrategy.first
case PathList("org", "w3c", "dom", "TypeInfo.class") => MergeStrategy.first
case "jboss-beans.xml" => MergeStrategy.first
case "application.conf" => MergeStrategy.concat
case "unwanted.txt" => MergeStrategy.discard
case "rootdoc.txt" => MergeStrategy.discard
case x => old(x)
}
}
case PathList(ps @ _*) if ps.last endsWith ".key" => MergeStrategy.first
mergeStrategy in assembly <<= (mergeStrategy in assembly) { (old) =>
{
case PathList(ps @ _*) if ps.last endsWith ".key" => MergeStrategy.first
case PathList("org", "jboss", "netty", xs @ _*) => MergeStrategy.first
case PathList("META-INF", "jboss-beans.xml") => MergeStrategy.first
case PathList("org", "w3c", "dom", "TypeInfo.class") => MergeStrategy.first
case "jboss-beans.xml" => MergeStrategy.first
case "application.conf" => MergeStrategy.concat
case "unwanted.txt" => MergeStrategy.discard
case "rootdoc.txt" => MergeStrategy.discard
case x =>
//val old = (mergeStrategy in assembly).value
old(x)
}
}
最佳答案
看起来您有 2 个名为 mydef.key 的文件
但是因为它们的内容不一样并且 sbt-assembly 没有规则如何合并它,所以引发了异常。
检查哪些是内容以及它们是否对您的构建很重要。
如果不只是尝试添加:
case "mydef.key" => MergeStrategy.first
关于Scala:SBT:mergeStrategy:deduplicate:在以下内容中发现不同的文件内容:,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29151185/
我正在尝试使用 sbt-assembly 插件构建一个胖 Jar。我使用的是 SBT 版本 0.13.1 和程序集插件版本:0.11.2。 每当我在 sbt 控制台中运行程序集命令时,都会遇到此错误:
我是一名优秀的程序员,十分优秀!