2016-12-15 61 views
1

由於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文件。

+2

看起來解決方案在第一個片段中被註釋掉了。 :-) – stefanobaghino

回答

0

請遷移至build.sbt風格。 http://www.scala-sbt.org/0.13/docs/Basic-Def.html

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

的* .scala風格一直鼓勵在文檔和,SBT 0.13.13正式不贊成它。其中一個原因是Project(...)settings參數與自動插件初始化順序不兼容。如果你遷移到build.sbt風格,它應該被解決。