我是sbt和sbt-assembly插件的新手。我试图在scala play项目中从不同的包构建2个jar。我在https://github.com/sbt/sbt-assembly中阅读了“合并策略”部分,但仍然不太了解路径名称的映射是如何工作的。你能告诉我一下吗?
我不太明白sbt merge策略如何真正适用于重复数据删除错误?
[error] 2 errors were encountered during merge
[error] java.lang.RuntimeException: deduplicate: different file contents found in the following:
[error] /.ivy2/cache/org.apache.logging.log4j/log4j-core/jars/log4j-core-2.10.0.jar:META-INF/org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat
[error] /.ivy2/cache/io.sensefly.logging.log4j/log4j-cloudwatch-appender/jars/log4j-cloudwatch-appender-1.0.1.jar:META-INF/org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat
[error] deduplicate: different file contents found in the following:
[error] /.ivy2/cache/com.typesafe.play/play_2.12/jars/play_2.12-2.6.6.jar:play/reference-overrides.conf
[error] /.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
[error] at sbtassembly.Assembly$.applyStrategies(Assembly.scala:142)
[error] at sbtassembly.Assembly$.x$1$lzycompute$1(Assembly.scala:26)
[error] at sbtassembly.Assembly$.x$1$1(Assembly.scala:24)
[error] at sbtassembly.Assembly$.stratMapping$lzycompute$1(Assembly.scala:24)
[error] at sbtassembly.Assembly$.stratMapping$1(Assembly.scala:24)
[error] at sbtassembly.Assembly$.inputs$lzycompute$1(Assembly.scala:68)
[error] at sbtassembly.Assembly$.inputs$1(Assembly.scala:58)
[error] at sbtassembly.Assembly$.apply(Assembly.scala:85)
[error] at sbtassembly.Assembly$.$anonfun$assemblyTask$1(Assembly.scala:249)
[error] at scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:42)
[error] at sbt.std.Transform$$anon$4.work(System.scala:64)
[error] at sbt.Execute.$anonfun$submit$2(Execute.scala:257)
[error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error] at sbt.Execute.work(Execute.scala:266)
[error] at sbt.Execute.$anonfun$submit$1(Execute.scala:257)
[error] at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:167)
[error] at sbt.CompletionService$$anon$2.call(CompletionService.scala:32)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error] at java.lang.Thread.run(Thread.java:748)
[error] (midi/*:assembly) deduplicate: different file contents found in the following:
[error] /.ivy2/cache/org.apache.logging.log4j/log4j-core/jars/log4j-core-2.10.0.jar:META-INF/org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat
[error] /.ivy2/cache/io.sensefly.logging.log4j/log4j-cloudwatch-appender/jars/log4j-cloudwatch-appender-1.0.1.jar:META-INF/org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat
[error] deduplicate: different file contents found in the following:
[error] /.ivy2/cache/com.typesafe.play/play_2.12/jars/play_2.12 2.6.6.jar:play/reference-overrides.conf
[error] /.ivy2/cache/com.typesafe.play/play-akka-http-server_2.12/jars/play-a
[error] /.ivy2/cache/io.sensefly.logging.log4j/log4j-cloudwatch-appender/jars/log4j-cloudwatch-appender-1.0.1.jar:META-INF/org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat
[error] deduplicate: different file contents found in the following:
[error] /.ivy2/cache/com.typesafe.play/play_2.12/jars/play_2.12-2.6.6.jar:play/reference-overrides.conf
[error] /.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
libraryDependencies ++= Seq(
ehcache ,
ws ,
specs2 % Test ,
guice,
"com.typesafe.slick" %% "slick" % "3.2.1",
"com.h2database" % "h2" % "1.4.194",
"mysql" % "mysql-connector-java" % "6.0.6",
"org.scalatest" %% "scalatest" % "3.0.4" % Test,
"org.scalatestplus.play" %% "scalatestplus-play" % "3.1.2" % Test,
"io.swagger" % "swagger-parser" % "1.0.9",
"org.flywaydb" % "flyway-core" % "4.2.0", // DB migrations
"org.flywaydb" %% "flyway-play" % "4.0.0", // Play support
"org.apache.logging.log4j" % "log4j-api" % "2.10.0",
"org.apache.logging.log4j" % "log4j-core" % "2.10.0", //log4j
"io.sensefly.logging.log4j" % "log4j-cloudwatch-appender" % "1.0.1",
"org.scalamock" %% "scalamock" % "4.0.0",
"org.scalatest" %% "scalatest" % "3.0.4"
).map(_.exclude("rg.apache.logging.log4j", "rg.apache.logging.log4j"))
.map(_.exclude("commons-logging", "commons-logging"))
.map(_.exclude("log4j-cloudwatch-appender", "log4j-cloudwatch-appender"))
.map(_.exclude("com.typesafe.play", "com.typesafe.play"))