因此,對於一種依賴關係,我已經進入了一種我無法逃避的糾纏程度。我不願意想,當我在評論罐子把會發生什麼:需要路徑列表模式才能使sbt高興
libraryDependencies ++= Seq(
// "org.apache.avro" % "avro" % "1.8.1" excludeAll ExclusionRule(organization = "log4j"),
// "org.apache.kafka" %% "kafka" % "0.10.0.0",
"org.apache.hive" % "hive-jdbc" % "1.2.2"
excludeAll ExclusionRule(organization = "log4j")
exclude("org.apache.hadoop", "hadoop-yarn-api"),
"log4j" % "log4j" % "1.2.16"
)
使用SBT組裝,我得到了以下重複數據刪除的問題:
[error] (*:assembly) deduplicate: different file contents found in the following:
[error] C:\Users\G517329\.ivy2\cache\org.datanucleus\datanucleus-api-jdo\jars\datanucleus-api-jdo-3.2.6.jar:plugin.xml
[error] C:\Users\G517329\.ivy2\cache\org.datanucleus\datanucleus-core\jars\datanucleus-core-3.2.10.jar:plugin.xml
[error] C:\Users\G517329\.ivy2\cache\org.datanucleus\datanucleus-rdbms\jars\datanucleus-rdbms-3.2.9.jar:plugin.xml
如果我堅持試圖找到一個合併策略,允許這三個罐子高興地共存於一個脂肪罐中。我試過下面戰略的若干變化,但我沒有取得什麼進展:
assemblyMergeStrategy in assembly := {
case PathList("javax", "transaction", xs @ _*) => MergeStrategy.first
case PathList(xs @ _*) if xs.last endsWith "plugin.xml" => MergeStrategy.discard
// case PathList("org", "datanucleus", "datanucleus-api-jdo", xs @ _*) => MergeStrategy.last
// case PathList("org", "datanucleus", "datanucleus-rdbms", xs @ _*) => MergeStrategy.last
case PathList("META-INF", xs @ _*) => MergeStrategy.discard
case x =>
val oldStrategy = (assemblyMergeStrategy in assembly).value
oldStrategy(x)
}
我必須是如何工作的一些誤會,因爲在我看來,第二行應該找到每一個plugin.xml
文件中的每個罐子並將其核武。
有沒有人成功地將hive-jdbc包含在一個胖罐子裏?
UPDATE:
case "plugin.xml" => MergeStrategy.discard //or .last
應該工作,我會想,但拋出:
[error] (*:assembly) java.util.NoSuchElementException