使用SBT汇编插件排除jar

时间:2013-12-04 15:07:04

标签: scala sbt sbt-assembly

我正在努力在build.scala中提供排除模式。我看过他们提到的关于build.sbt的帖子很少。我是sbt的新手。有人可以帮我在build.scala中编写排除模式。

我想在运行程序集时排除以下两个导致错误的程序包: xmlbeans和xml-apis

Error : 
[trace] Stack trace suppressed: run last app/*:assembly for the full output.
[error] (app/*:assembly) deduplicate: different file contents found in the following:
[error] /Users/rajeevprasanna/.ivy2/cache/org.apache.xmlbeans/xmlbeans/jars/xmlbeans-2.3.0.jar:org/w3c/dom/TypeInfo.class
[error] /Users/rajeevprasanna/.ivy2/cache/xml-apis/xml-apis/jars/xml-apis-1.3.03.jar:org/w3c/dom/TypeInfo.class

我在编写build.scala时引用了这个文件:https://github.com/eed3si9n/sbt-assembly-full-config-sample/blob/master/project/builds.scala

1 个答案:

答案 0 :(得分:5)

找出哪个依赖项(“oldstuff”)在错误版本的xmlbeans或xml-apis中提取,并排除一个或两个依赖项,如下所示:

libraryDependencies ++= Seq(
  "org.old"  % "oldstuff"" % "0.5" 
     exclude ("org.apache.xmlbeans", "xmlbeans")
     exclude ("xml-apis", "xml-apis"),
  ...
  ...
)

您可能需要查看~/.ivy2/cache目录以获取确切的名称。

相关问题