sbt assembly akka-stream_2.12:2.4.19和akka-actor_2.12:2.4.19被驱逐

时间:2017-06-30 10:21:24

标签: jar sbt akka akka-stream sbt-assembly

我想用sbt汇编制作我的项目的胖罐。这是我的build.sbt:

name := "projName"

version := "1.0"

scalaVersion := "2.12.1"


libraryDependencies ++= Seq(
  "com.typesafe.akka" %% "akka-stream" % "2.5.3",
  "com.typesafe.akka" %% "akka-actor" % "2.5.3",
  "com.typesafe.akka" %% "akka-http" % "10.0.8",
  "com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.8.6",
  "com.typesafe" % "config" % "1.3.1",
  "org.apache.kafka" % "kafka-clients" % "0.10.2.1",
  "org.knowm.xchange" % "xchange-core" % "4.2.0",
  "org.knowm.xchange" % "xchange-btce" % "4.2.0"
)

assemblyMergeStrategy in assembly := {
  case PathList("META-INF", xs @ _*) => MergeStrategy.discard
  case x => MergeStrategy.first
}

运行后

sbt assembly

我收到了这样的警告:

[warn] There may be incompatibilities among your library dependencies.
[warn] Here are some of the libraries that were evicted:
[warn]  * com.typesafe.akka:akka-stream_2.12:2.4.19 -> 2.5.3
[warn]  * com.typesafe.akka:akka-actor_2.12:2.4.19 -> 2.5.3
[warn] Run 'evicted' to see detailed eviction warnings

然后我运行sbt evicted以获取更多详细信息,以及我得到的内容:

[warn] There may be incompatibilities among your library dependencies.
[warn] Here are some of the libraries that were evicted:
[warn]  * com.typesafe.akka:akka-stream_2.12:2.4.19 -> 2.5.3 (caller: com.typesafe.akka:akka-http-core_2.12:10.0.8, default:btceclient_2.12:1.0)
[warn]  * com.typesafe.akka:akka-actor_2.12:2.4.19 -> 2.5.3 (caller: com.typesafe.akka:akka-stream_2.12:2.5.3, com.typesafe.akka:akka-parsing_2.12:10.0.8, default:btceclient_2.12:1.0)
[info] Here are other libraries that were evicted:
[info]  * com.fasterxml.jackson.core:jackson-databind:2.8.2 -> 2.8.6 (caller: com.fasterxml.jackson.module:jackson-module-paranamer:2.8.6, com.github.mmazi:rescu:1.9.0, com.fasterxml.jackson.module:jackson-module-scala_2.12:2.8.6)
[info]  * com.fasterxml.jackson.core:jackson-annotations:2.8.0 -> 2.8.6 (caller: com.fasterxml.jackson.core:jackson-databind:2.8.6, com.fasterxml.jackson.module:jackson-module-scala_2.12:2.8.6)
[info]  * com.typesafe:config:1.2.0 -> 1.3.1 (caller: com.typesafe:ssl-config-core_2.12:0.2.1, default:btceclient_2.12:1.0, com.typesafe.akka:akka-actor_2.12:2.5.3)

我知道什么是驱逐警告,但我不知道如何在当前情况下解决这个问题。有什么想法吗?

3 个答案:

答案 0 :(得分:1)

修改后的合并策略:

assemblyMergeStrategy in assembly := {
      case PathList("META-INF", xs @ _*) => MergeStrategy.discard
      case PathList("reference.conf") => MergeStrategy.concat
      case x => MergeStrategy.first
    }

在这里,您可以看到新行:case PathList("reference.conf") => MergeStrategy.concat 我认为不必解释这里发生的事情。

答案 1 :(得分:0)

驱逐信息很明确。 akka-http_2.12 : 10.0.8的maven快速search将向您显示此工件取决于akka-stream_2.12:2.4.19。 一种解决方案是,您可以在依赖项设置中将akka-actorakka-stream降级为2.4.19。

答案 2 :(得分:0)

您可以安全地忽略此消息,因为2.4和2.5版本are binary compatible,因此可以从2.4升级到2.5。