需要路径列表模式才能使sbt满意
因此,有了一种依赖,我就进入了一种无法逃避的纠结状态。我不愿意去想当我带着评论过的罐子时会发生什么:需要路径列表模式才能使sbt满意,sbt,sbt-assembly,Sbt,Sbt Assembly,因此,有了一种依赖,我就进入了一种无法逃避的纠结状态。我不愿意去想当我带着评论过的罐子时会发生什么: 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-jdb
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 assembly,我遇到了以下重复数据消除问题:
[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)
}
我一定对它的工作原理有一些误解,因为在我看来,第二行应该在每个jar中找到每个plugin.xml
文件,并对其进行核处理
有人成功地将HiveJDBC包含在一个胖罐子中吗
更新:
case“plugin.xml”=>MergeStrategy.discard//或.last
应该可以工作,我想,但这会引发:
[error](*:assembly)java.util.NoSuchElementException
所以我今天早上加载了这个项目,并再试了一次。这次
case“plugin.xml”=>MergeStrategy.last
不扔,我有一个胖罐子
嗯
更新:
我不知道问题出在哪里(Intellij、SBT控制台、SBT程序集),但是有一些缓存正在进行,这使得解决合并问题非常困难。我发现,确保我在build.sbt中对代码所做的更改得到实际应用的唯一可靠方法是关闭整个IDE并重新打开它