如何将合并策略添加到我的构建设置

时间:2016-12-15 18:05:48

标签: scala sbt

目前我的构建失败,因为mergeStrategy不正确。

我该如何解决这个问题?

object MyAppBuild extends Build {
  import Resolvers._
  import Dependency._
  import BuildSettings._

  lazy val myApp = Project(
    id = "myApp",
    base = file("."),
    settings = buildSettings ++ Seq(
      resolvers := allResolvers,
      exportJars := true,
      libraryDependencies ++= Dependencies.catalogParserDependencies,
      parallelExecution in Test := false,
      //mergeStrategy in assembly := {
        // ....
      //}

    )
  )
}

如果我在build.sbt文件中有我的设置,它的工作方式如下:

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

我现在想把这个逻辑移到我的Build.scala文件中。

1 个答案:

答案 0 :(得分:0)

请迁移到build.sbt样式。 {{3}}

lazy val myApp = Project(
    id = "myApp",
    base = file("."),
    settings = buildSettings ++ ... // this is likely the problem

在文档中不鼓励* .scala样式,并且sbt 0.13.13正式弃用它。其中一个原因是Project(...)的{​​{1}}参数与自动插件初始化顺序不兼容。如果迁移到build.sbt样式,则应解析它。