我在Scala项目中使用Slick 3.1.1。我的build.sbt libraryDependencies
包含以下内容:
"com.typesafe.slick" %% "slick" % "3.1.1",
"com.typesafe.slick" %% "slick-hikaricp" % "3.1.1",
"com.zaxxer" % "HikariCP" % "2.4.3",
"mysql" % "mysql-connector-java" % "5.1.38",
一切正常。但是,当我尝试使用sbt-assembly
部署时,我会收到如下错误:
[error] deduplicate: different file contents found in the following:
[error] /home/thunderkid/.ivy2/cache/com.zaxxer/HikariCP-java6/bundles/HikariCP-java6-2.3.7.jar:com/zaxxer/hikari/pool/HikariPool.class
[error] /home/thunderkid/.ivy2/cache/com.zaxxer/HikariCP/bundles/HikariCP-2.4.3.jar:com/zaxxer/hikari/pool/HikariPool.class
我该如何解决这些问题?
以前我使用的是Slick 3.0,它不需要slick-hikaricp
,而且运行正常。我尝试删除.ivy2/cache/com.zaxxer/HikariCP-java6
,但这不起作用 - 它只是重新创建。我的mergeStrategy
是
mergeStrategy in assembly <<= (mergeStrategy in assembly) { (old) =>
{
case PathList(ps @ _*) if ps.last endsWith "ArgumentsProcessor.class" => MergeStrategy.first
case PathList(ps @ _*) if ps.last endsWith "MatchersBinder.class" => MergeStrategy.first
case "application.conf" => MergeStrategy.concat
case "unwanted.txt" => MergeStrategy.discard
case x => old(x)
}
}
答案 0 :(得分:0)
在上面的评论中关注@ brettw的建议,我通过在exclude
中添加build.sbt
命令来实现它,如下所示:
"com.typesafe.slick" %% "slick-hikaricp" % "3.1.1" exclude("com.zaxxer", "HikariCP-java6"),