Rajeev
Rajeev

Reputation: 5012

exclude jars with SBT assemble plugin

I am struggling to give exclude pattern in build.scala. I have seen few posts where they mentioned about build.sbt. I am new to sbt. Can someone help me to write exclude pattern in build.scala.

I want to exclude below two packages which causes error while running assembly : xmlbeans and 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

I wrote build.scala in reference to this file : https://github.com/eed3si9n/sbt-assembly-full-config-sample/blob/master/project/builds.scala

Upvotes: 2

Views: 5492

Answers (1)

Richard Close
Richard Close

Reputation: 1905

Figure out which dependency ("oldstuff") is pulling in the wrong version of xmlbeans or xml-apis, and exclude one or both dependencies like so:

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

You may need to look in your ~/.ivy2/cache directory to get the exact names.

Upvotes: 5

Related Questions