sbt 程序集重复数据删除:在以下位置找到不同的文件内容:jackson-annotations

Posted

技术标签:

【中文标题】sbt 程序集重复数据删除:在以下位置找到不同的文件内容:jackson-annotations【英文标题】:sbt assembly deduplicate: different file contents found in the following: jackson-annotations 【发布时间】:2021-02-27 16:10:33 【问题描述】:

拥有这些部门:

libraryDependencies ++= Seq(
  "com.typesafe.akka" %% "akka-http-spray-json" % akkaHttpVersion,
  "com.typesafe.akka" %% "akka-stream" % akkaVersion,
  "com.typesafe.akka" %% "akka-http" % akkaHttpVersion,
  "com.typesafe.akka" %% "akka-actor-typed" % akkaVersion,
  "com.typesafe.akka" %% "akka-stream" % akkaVersion,
  "com.lightbend.akka" %% "akka-stream-alpakka-json-streaming" % akkaJsonStreaming,
  "io.circe" %% "circe-generic-extras" % circeVersion,
  "de.heikoseeberger" %% "akka-http-circe" % akkaHttpCirce,
  "commons-codec" % "commons-codec" % commonsCodecVersion,
  "org.scalatest" %% "scalatest" % scalaTestVersion % "it, test",
)

当我运行 sbt assembly 时出现错误:

[error] (assembly) deduplicate: different file contents found in the following:
[error] /home/baku/.cache/coursier/v1/https/repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-annotations/2.10.5/jackson-annotations-2.10.5.jar:module-info.class
[error] /home/baku/.cache/coursier/v1/https/repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-core/2.10.5/jackson-core-2.10.5.jar:module-info.class
[error] /home/baku/.cache/coursier/v1/https/repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-databind/2.10.5/jackson-databind-2.10.5.jar:module-info.class

知道如何解决这个问题吗?

【问题讨论】:

您能分享一下akkaHttpVersionakkaVersionakkaJsonStreaming,以及您正在使用的所有其他版本吗? @TomerShetah val akkaVersion = "2.6.8", val akkaHttpVersion = "10.2.0", val akkaJsonStreaming = "2.0.2" 【参考方案1】:
assemblyMergeStrategy in assembly := 
      case "module-info.class" => MergeStrategy.discard
      case x =>
        val oldStrategy = (assemblyMergeStrategy in assembly).value
        oldStrategy(x)
    

这有帮助

【讨论】:

以上是关于sbt 程序集重复数据删除:在以下位置找到不同的文件内容:jackson-annotations的主要内容,如果未能解决你的问题,请参考以下文章

sbt 程序集合并问题 [去重:在下面找到不同的文件内容]

SBT 程序集从另一个 JAR 中删除类

Swift可变集:找到重复元素

sbt-assembly:发现重复数据删除错误

Scala sbt 程序集 jar 不起作用(未找到类实现)但通过 IntelliJ 时代码可以工作 [关闭]

当我们尝试在 sbt 文件中使用 cloudera 上游版本时,sbt 程序集构建失败