我正在尝试用GitLab构建一个项目。在gitlab-ci.yml中,我运行了sbt程序集,遇到了恼人的异常。
[error] (soda/*:assembly) deduplicate: different file contents found in the following:
[error] /root/.ivy2/cache/io.netty/netty-buffer/jars/netty-buffer-4.0.42.Final.jar:META-INF/io.netty.versions.properties
[error] /root/.ivy2/cache/io.netty/netty-common/jars/netty-common-4.0.42.Final.jar:META-INF/io.netty.versions.properties
[error] /root/.ivy2/cache/io.netty/netty-codec-http/jars/netty-codec-http-4.0.42.Final.jar:META-INF/io.netty.versions.properties
[error] /root/.ivy2/cache/io.netty/netty-codec/jars/netty-codec-4.0.42.Final.jar:META-INF/io.netty.versions.properties
[error] /root/.ivy2/cache/io.netty/netty-transport/jars/netty-transport-4.0.42.Final.jar:META-INF/io.netty.versions.properties
[error] /root/.ivy2/cache/io.netty/netty-handler/jars/netty-handler-4.0.42.Final.jar:META-INF/io.netty.versions.properties
[error] /root/.ivy2/cache/io.netty/netty-transport-native-epoll/jars/netty-transport-native-epoll-4.0.42.Final-linux-x86_64.jar:META-INF/io.netty.versions.properties
我尝试按照sbt-assembly: deduplication found error中的说明进行操作,看起来MergeStrategy已经就位了,但是例外仍然存在:
[info] Merging files...
[warn] Merging 'NOTICE' with strategy 'rename'
[warn] Merging 'README' with strategy 'rename'
[warn] Merging 'META-INF/NOTICE.txt' with strategy 'rename'
[warn] Merging 'license/NOTICE' with strategy 'rename'
[warn] Merging 'META-INF/NOTICE' with strategy 'rename'
[warn] Merging 'org/xerial/snappy/native/README' with strategy 'rename'
[warn] Merging 'license' with strategy 'rename'
[warn] Merging 'license/LICENSE' with strategy 'rename'
[warn] Merging 'META-INF/license' with strategy 'rename'
[warn] Merging 'META-INF/LICENSE.txt' with strategy 'rename'
[warn] Merging 'LICENSE.txt' with strategy 'rename'
[warn] Merging 'META-INF/LICENSE' with strategy 'rename'
[warn] Merging 'LICENSE' with strategy 'rename'
[warn] Merging 'META-INF/DEPENDENCIES' with strategy 'discard'
[warn] Merging 'META-INF/INDEX.LIST' with strategy 'discard'
[warn] Merging 'META-INF/MANIFEST.MF' with strategy 'discard'
我还试图更改sbt版本,但问题仍然存在。
任何关于我如何解决这个问题的帮助都将是很好的。
发布于 2019-04-23 16:27:40
我曾经遇到过一些Java包和log4j的类似问题,我所做的是创建一个自定义的合并策略,在这个策略中我只选择第一个出现的地方。也许您可以调整该代码以使其适合您:
assemblyMergeStrategy in assembly := {
// case PathList("javax", "servlet", xs @ _*) => MergeStrategy.first
case PathList("org", "apache", "commons", xs @ _*) =>
// println(s"$xs")
MergeStrategy.first
case PathList(ps @ _*) if ps.last endsWith ".html" => MergeStrategy.first
case "application.conf" => MergeStrategy.concat
case "log4j.properties" => MergeStrategy.first
case "unwanted.txt" => MergeStrategy.discard
case x =>
val oldStrategy = (assemblyMergeStrategy in assembly).value
oldStrategy(x)
}
也许如果你改变了
case PathList("org", "apache", "commons", xs @ _*) =>
// println(s"$xs")
MergeStrategy.first
对于有问题的包(netty
),您可以设法解决它:
case PathList("io", "netty", xs @ _*) =>
// println(s"$xs")
MergeStrategy.first
https://stackoverflow.com/questions/55806027
复制相似问题