Sbt RuntimeException: deduplicate

I have a new Scala project that runs fine interactively, but fails to build. It’s giving me deduplicate error on org.springframework, and I can’t seem to figure out how to make it build.

Can anyone offer any advice?

TIA

[error] 1 error was encountered during merge
[error] java.lang.RuntimeException: deduplicate: different file contents found in the following:
[error] C:\Users\user\.ivy2\cache\org.springframework\spring-context\jars\spring-context-3.0.7.RELEASE.jar:overview.html
[error] C:\Users\user\.ivy2\cache\org.springframework\spring-aop\jars\spring-aop-3.0.7.RELEASE.jar:overview.html
[error] C:\Users\user\.ivy2\cache\org.springframework\spring-beans\jars\spring-beans-3.0.7.RELEASE.jar:overview.html
[error] C:\Users\user\.ivy2\cache\org.springframework\spring-core\jars\spring-core-3.0.7.RELEASE.jar:overview.html
[error]         at sbtassembly.Assembly$.applyStrategies(Assembly.scala:142)
[error]         at sbtassembly.Assembly$.x$1$lzycompute$1(Assembly.scala:26)
[error]         at sbtassembly.Assembly$.x$1$1(Assembly.scala:24)
[error]         at sbtassembly.Assembly$.stratMapping$lzycompute$1(Assembly.scala:24)
[error]         at sbtassembly.Assembly$.stratMapping$1(Assembly.scala:24)
[error]         at sbtassembly.Assembly$.inputs$lzycompute$1(Assembly.scala:68)
[error]         at sbtassembly.Assembly$.inputs$1(Assembly.scala:58)
[error]         at sbtassembly.Assembly$.apply(Assembly.scala:85)
[error]         at sbtassembly.Assembly$.$anonfun$assemblyTask$1(Assembly.scala:249)
[error]         at scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error]         at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:40)
[error]         at sbt.std.Transform$$anon$4.work(System.scala:67)
[error]         at sbt.Execute.$anonfun$submit$2(Execute.scala:269)
[error]         at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error]         at sbt.Execute.work(Execute.scala:278)
[error]         at sbt.Execute.$anonfun$submit$1(Execute.scala:269)
[error]         at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:178)
[error]         at sbt.CompletionService$$anon$2.call(CompletionService.scala:37)
[error]         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error]         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error]         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error]         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error]         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error]         at java.lang.Thread.run(Thread.java:748)
[error] (assembly) deduplicate: different file contents found in the following:
[error] C:\Users\user\.ivy2\cache\org.springframework\spring-context\jars\spring-context-3.0.7.RELEASE.jar:overview.html
[error] C:\Users\user\.ivy2\cache\org.springframework\spring-aop\jars\spring-aop-3.0.7.RELEASE.jar:overview.html
[error] C:\Users\user\.ivy2\cache\org.springframework\spring-beans\jars\spring-beans-3.0.7.RELEASE.jar:overview.html
[error] C:\Users\user\.ivy2\cache\org.springframework\spring-core\jars\spring-core-3.0.7.RELEASE.jar:overview.html
[error] Total time: 15 s, completed Mar 19, 2020 7:50:35 AM

Hi.

You have to resolve those errors by defining a merge strategy.

See https://github.com/sbt/sbt-assembly#merge-strategy

Since the overview.html is probably not vital for running the application, try to discard it with using

case "overview.html"    => MergeStrategy.discard

For other files, you have to decide on a case-by-case basis.

1 Like

I added that line to my existing assemblyMergeStrategy, restarted IntelliJ and it worked! Thank you