sbt程序集错误重复数据删除

时间:2017-01-24 17:21:41

标签: scala sbt sbt-assembly

开始使用sbt。 我在sbt assembly期间收到此错误

  

重复数据删除:在以下内容中找到不同的文件内容:       ../.ivy2/cache/org.scalatest/scalatest_2.11/bundles/scalatest_2.11-2.2.6.jar:org/scalactic/SeqEqualityConstraints$.class       。../ ivy2 /高速缓存/ org.scalactic / scalactic_2.11 /捆绑/ scalactic_2.11-3.0.0.jar:组织/ scalactic / SeqEqualityConstraints $的.class

这是我的构建sbt:

scalaVersion  := "2.11.8"
scalacOptions := Seq("-unchecked", "-feature", "-deprecation", "-encoding", "utf8")

libraryDependencies ++= {
  val phantomV          = "1.29.5"
  val scalaTestV        = "2.2.6"
  val scalaMockV        = "3.4.2"
  val elastic4sV        = "2.4.0"
  val akkaStreamVersion = "2.4.10"
  val akkaVersion       = "2.3.12"
  Seq(
    "com.websudos"            %% "phantom-dsl"                        % phantomV,
    "com.websudos"            %% "phantom-reactivestreams"            % phantomV,
    "com.websudos"            %% "util-testing"                       % "0.13.0" % "test, provided",
    "com.typesafe.akka"       %% "akka-actor"                         % akkaVersion,
    "com.typesafe.akka"       %% "akka-http-spray-json-experimental"  % akkaStreamVersion,
    "com.typesafe.akka"       %% "akka-http-core"                     % akkaStreamVersion,
    "com.typesafe.akka"       %% "akka-http-experimental"             % akkaStreamVersion,
    "com.typesafe.akka"       %% "akka-http-testkit"                  % akkaStreamVersion,
    "com.typesafe.akka"       %% "akka-stream"                        % akkaStreamVersion,
    "com.typesafe.akka"       %% "akka-stream-testkit"                % akkaStreamVersion,
    "org.scalatest"           %% "scalatest"                          % scalaTestV  % "test, provided",
    "com.typesafe.akka"       %% "akka-testkit"                       % akkaVersion  % "test, provided",
    "com.typesafe.play"       %% "play-streams-experimental"          % "2.4.6"     % "provided",
    "com.sksamuel.elastic4s"  %% "elastic4s-core"                     % elastic4sV,
    "com.sksamuel.elastic4s"  %% "elastic4s-streams"                  % elastic4sV,
    "org.scalamock"           %% "scalamock-scalatest-support"        % scalaMockV % "test, provided",
    "com.typesafe"            % "config"                              % "1.3.1"

  )
}
lazy val root = project.in(file("."))
  .settings(mainClass in assembly := Some("com.ind.Main"))

initialCommands := """|import akka.actor._
                      |import akka.pattern._
                      |import akka.util._
                      |import scala.concurrent._
                      |import scala.concurrent.duration._""".stripMargin

fork in run := true
test in assembly := {}

知道为什么要这样做,我该如何解决呢?

=====更新==== 我确实设法通过添加

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

2 个答案:

答案 0 :(得分:0)

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

答案 1 :(得分:0)

ScalaTest和Scalactic版本号需要匹配。你有一个ScalaTest 2.2.6尝试使用Scalactic 3.0.0,这就是问题所在。您的一个依赖项可能是使用Scalactic 3.0.0。