Closed
Description
Now that Scala 2.12.13 backported @nowarn
, projects that use sbt-assembly need to handle a class conflict:
[error] java.lang.RuntimeException: deduplicate: different file contents found in the following:
333
[error] /home/runner/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/modules/scala-collection-compat_2.12/2.3.2/scala-collection-compat_2.12-2.3.2.jar:scala/annotation/nowarn$.class
334
[error] /home/runner/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.12.13/scala-library-2.12.13.jar:scala/annotation/nowarn$.class
335
[error] deduplicate: different file contents found in the following:
336
[error] /home/runner/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/modules/scala-collection-compat_2.12/2.3.2/scala-collection-compat_2.12-2.3.2.jar:scala/annotation/nowarn.class
337
[error] /home/runner/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.12.13/scala-library-2.12.13.jar:scala/annotation/nowarn.class
I tested it with both scala-collection-compat 2.3.2 and 2.4.1.
The workaround I have been using to let sbt-assembly pick one by adding the following setting:
assembly / assemblyMergeStrategy := {
case PathList("scala", "annotation", "nowarn.class" | "nowarn$.class") =>
MergeStrategy.first
case x =>
(assembly / assemblyMergeStrategy).value.apply(x)
},
I wonder if nowarn
can be removed from future versions of scala-collection-compat now that it's available in 2.12?