2017-10-21 156 views
2

極力打造的一齣戲(2.6.6)+ scala.js應用脂肪罐子,讓錯誤與SBT組裝和播放框架

[錯誤](播放/ *:組裝)進行重複數據刪除:不同的文件內容在下面找到: [error] /home/user/.ivy2/cache/com.typesafe.play/play_2.12/jars/play_2.12-2.6.6.jar:play/reference-overrides。 conf [error] /home/user/.ivy2/cache/com.typesafe.play/play-akka-http-server_2.12/jars/play-akka-http-server_2.12-2.6.6.jar:play /reference-overrides.conf

build.sbt

mainClass in assembly := Some("play.core.server.ProdServerStart") 
//fullClasspath in assembly += Attributed.blank(PlayKeys.playPackageAssets.value) 

(由https://www.playframework.com/documentation/2.6.6/Deploying#Using-the-SBT-assembly-plugin啓發)

(而不是使用目前playPackageAssets)

assembly.sbt只包含addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.5")

我也試圖與 「非標」 配置:

assemblyMergeStrategy in assembly := { 
// Building fat jar without META-INF 
case PathList("META-INF", xs @ _*) => MergeStrategy.discard 
// Take last config file 
case PathList(ps @ _*) if ps.last endsWith ".conf" => MergeStrategy.last 
case o => 
    val oldStrategy = (assemblyMergeStrategy in assembly).value 
    oldStrategy(o) 
} 

但沒有運氣。如何解決/正確的方法?

回答

2

你需要告訴sbt-assembly如何合併這兩個reference-overrides.conf配置文件:

assemblyMergeStrategy in assembly := { 
// Building fat jar without META-INF 
case PathList("META-INF", xs @ _*) => MergeStrategy.discard 
// Take last config file 
case PathList(ps @ _*) if ps.last endsWith ".conf" => MergeStrategy.last 
case PathList("reference-overrides.conf") => MergeStrategy.concat 
case o => 
    val oldStrategy = (assemblyMergeStrategy in assembly).value 
    oldStrategy(o) 
} 
+0

其實我認爲,前行了一個以'的endsWith「的.conf」'會照顧的那個(是的,我發現它並不是concat!)但唉...謝謝! – Sorona

+0

雖然:(儘管sbt被刷新)仍然給了我完全相同的錯誤信息 – Sorona

+0

@Sorona我認爲我們得到的路徑錯了,請嘗試:'case「reference-overrides.conf」=> MergeStrategy.concat' –