gpt4 book ai didi

merge - 无法在多 jvm 节点测试中覆盖程序集合并策略

转载 作者:行者123 更新时间:2023-12-02 03:12:31 27 4
gpt4 key购买 nike

我无法覆盖依赖项的合并策略。

问题源于cassandra依赖独立的netty模块

val akkaCassandra = "com.typesafe.akka" %% "akka-persistence-cassandra" % "0.17"

如果我运行 graph-dependency,它会输出:

  | +-io.netty:netty-handler:4.0.33.Final
[info] | +-io.netty:netty-buffer:4.0.33.Final
[info] | | +-io.netty:netty-common:4.0.33.Final
[info] | |
[info] | +-io.netty:netty-codec:4.0.33.Final
[info] | | +-io.netty:netty-transport:4.0.33.Final
[info] | | +-io.netty:netty-buffer:4.0.33.Final
[info] | | +-io.netty:netty-common:4.0.33.Final
[info] | |
[info] | +-io.netty:netty-transport:4.0.33.Final
[info] | +-io.netty:netty-buffer:4.0.33.Final
[info] | +-io.netty:netty-common:4.0.33.Final

根据这个讨论,最好将合并策略定义为解决方案:

https://groups.google.com/a/lists.datastax.com/forum/#!msg/spark-connector-user/5muNwRaCJnU/sIHYh6PFEwAJ

Netty unfortunately has timing dependent markers in each io.versions.properties file in the metainfUntitled.jpg

This means the various components included all have different timestamps which is why everything is breaking. Unfortunately this is the underlying C* driver's dep, we could I guess exclude these netty modules from the driver and include netty-all in the connector instead but that seems like overkill.

I think just fixing the application build file is still the best solution.

据此,应该实现覆盖的能力:

https://github.com/typesafehub/sbt-multi-jvm/issues/22

Nested assembly config should be exposed for customization along with the other multijvm keys so that users can solve these issues.

i think that PR #19 will enable this functionality. the change at msfrank@fe862ff#diff-ad54d47177586fbaf474e402dd1b3dc5R137 will pass through the merge strategy defined with settings key (assemblyMergeStrategy in assembly) as long as the file is not one of *.class, *.txt, or NOTICE, which are hardcoded merge strategies

.

但是当我运行的时候

sbt:multi-node-test

lazy val test = Project(id = "core-tests", base = file("./modules/core/tests"))
.settings(SbtMultiJvm.multiJvmSettings: _*)
.settings(
libraryDependencies ++= Dependencies.coreTests,
assemblyMergeStrategy in assembly := {
case x if x.endsWith("META-INF/io.netty.versions.properties") ⇒ MergeStrategy.first
},
compile in MultiJvm <<= (compile in MultiJvm) triggeredBy (compile in Test),
parallelExecution in Test := false,
executeTests in Test <<= (executeTests in Test, executeTests in MultiJvm) map {
case (testResults, multiNodeResults) ⇒
val overall =
if (testResults.overall.id < multiNodeResults.overall.id)
multiNodeResults.overall
else
testResults.overall
Tests.Output(overall,
testResults.events ++ multiNodeResults.events,
testResults.summaries ++ multiNodeResults.summaries)
},
licenses := Seq(("CC0", url("http://creativecommons.org/publicdomain/zero/1.0"))),
Settings.levelDb, Settings.test)

它仍然拒绝使用我定义的合并策略。

[error] 1 error was encountered during merge

[trace] Stack trace suppressed: run 'last core-tests/multi-jvm:assembly' for the full output.

[error] (core-tests/multi-jvm:assembly) deduplicate: different file contents found in the following:

[error] ~/.ivy2/cache/io.netty/netty-handler/jars/netty-handler-4.0.33.Final.jar:META-INF/io.netty.versions.properties

[error] ~/.ivy2/cache/io.netty/netty-buffer/jars/netty-buffer-4.0.33.Final.jar:META-INF/io.netty.versions.properties

[error] ~/.ivy2/cache/io.netty/netty-common/jars/netty-common-4.0.33.Final.jar:META-INF/io.netty.versions.properties

[error] ~/.ivy2/cache/io.netty/netty-transport/jars/netty-transport-4.0.33.Final.jar:META-INF/io.netty.versions.properties

[error] ~/.ivy2/cache/io.netty/netty-codec/jars/netty-codec-4.0.33.Final.jar:META-INF/io.netty.versions.propertie

最佳答案

它对你不起作用,因为在你的代码中你覆盖了 sbt-assembly 任务的设置。

您需要做的是在 sbt-multi-jvm 插件的上下文中覆盖 sbt-assembly 的设置。

你可以这样做:

assemblyMergeStrategy in assembly in MultiJvm := {
case x if x.endsWith("META-INF/io.netty.versions.properties") ⇒ MergeStrategy.first
}

关于merge - 无法在多 jvm 节点测试中覆盖程序集合并策略,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39070874/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com