title: evict specific transitive dependency in sbt
body: <p>Suppose a small test project (sbt 0.13.8, full project as <a href="https://gist.github.com/wookietreiber/b8306d282f8b9151dc11" rel="nofollow">gist</a>):</p>
  
  <pre><code>name := "test"
  
  organization := "org.example"
  
  version := "0.1.0-SNAPSHOT"
  
  scalaVersion := "2.11.6"
  
  libraryDependencies ++= Seq (
    "com.lowagie"              %  "itext"         % "4.2.1",
    "com.github.wookietreiber" %% "scala-chart"   % "0.4.2"
  )
  </code></pre>
  
  <p>The dependency tree looks as follows:</p>
  
  <pre><code>dependencyTree
  [info] org.example:test_2.11:0.1.0-SNAPSHOT [S]
  [info]   +-com.github.wookietreiber:scala-chart_2.11:0.4.2 [S]
  [info]   | +-org.jfree:jfreechart:1.0.17
  [info]   | | +-org.jfree:jcommon:1.0.21
  [info]   | | +-xml-apis:xml-apis:1.3.04
  [info]   | | 
  [info]   | +-org.scala-lang.modules:scala-swing_2.11:1.0.1 [S]
  [info]   | 
  [info]   +-com.lowagie:itext:4.2.1
  [info]     +-bouncycastle:bctsp-jdk14:138
  [info]     | +-org.bouncycastle:bctsp-jdk14:1.38
  [info]     |   +-org.bouncycastle:bcmail-jdk14:1.38
  [info]     |   | +-org.bouncycastle:bcprov-jdk14:1.38
  [info]     |   | 
  [info]     |   +-org.bouncycastle:bcprov-jdk14:1.38
  [info]     |   
  [info]     +-dom4j:dom4j:1.6.1
  [info]     | +-xml-apis:xml-apis:1.0.b2 (evicted by: 1.3.04)
  [info]     | +-xml-apis:xml-apis:1.3.04
  [info]     | 
  [info]     +-jfree:jfreechart:1.0.12
  [info]     | +-jfree:jcommon:1.0.15
  [info]     | 
  [info]     +-org.swinglabs:pdf-renderer:1.0.5
  [info]     
  [success] Total time: 0 s, completed Jun 2, 2015 12:16:14 PM
  </code></pre>
  
  <p>The problem is the dependency <code>jfreechart</code> which gets pulled in by both <code>scala-chart</code> as well as by <code>itext</code> (same goes for <code>jcommon</code>, but I will focus on <code>jfreechart</code>). However, the slightly older version that gets pulled in by <code>itext</code> uses another organization name (<code>jfree</code> vs. <code>org.jfree</code>).</p>
  
  <p>Normally, if those would use the same organization, the older one would get evicted (as is done in the example with <code>xml-apis</code>) and there would be no conflicts as long as there is binary compatibility.</p>
  
  <p>The real conflict now is that both dependencies <code>jfree:jfreechart</code> and <code>org.jfree:jfreechart</code> are both on the classpath and provide the same classes. Compilation works fine and sbt does not even complain. Take e.g. the following example <code>App</code>:</p>
  
  <pre><code>package org.example
  
  import scalax.chart.api._
  
  object Main extends App {
    val data = for {
      i &lt;- 1 to 5
      category = i.toString
      date = new org.jfree.data.time.Day(i, 2, 1998)
      value = i * 2
    } yield category -&gt; Map(date -&gt; value)
  
    val chart = XYAreaChart.stacked(data.toTimeTable)
  
    chart.saveAsPDF("/tmp/my-chart.pdf")
  }
  </code></pre>
  
  <p>This compiles just fine! I don't know how sbt chooses which dependency to use. It all blows up if you try to actually run the thing:</p>
  
  <pre><code>sbt @ test $ compile
  [info] Updating {file:/home/wookietreiber/projects/scala/jfree-itext-test/}jfree-itext-test...
  [info] Resolving jline#jline;2.12.1 ...
  [info] Done updating.
  [info] Compiling 1 Scala source to /tmp/sbt/test/scala-2.11/classes...
  [success] Total time: 1 s, completed Jun 2, 2015 1:18:36 PM
  sbt @ test $ run
  [info] Running org.example.Main 
  [error] (run-main-1) java.lang.NoSuchMethodError: org.jfree.data.time.TimeTableXYDataset.add(Lorg/jfree/data/time/TimePeriod;Ljava/lang/Number;Ljava/lang/Comparable;Z)V
  java.lang.NoSuchMethodError: org.jfree.data.time.TimeTableXYDataset.add(Lorg/jfree/data/time/TimePeriod;Ljava/lang/Number;Ljava/lang/Comparable;Z)V
          at scalax.chart.module.RichChartingCollections$RichCategorizedTuple2s$$anonfun$toTimeTable$1$$anonfun$apply$4.apply(RichChartingCollections.scala:300)
  ...
  </code></pre>
  
  <p>To solve this, I would need to specifically evict / remove the older <code>jfree:jfreechart</code> and <code>jfree:jcommon</code> versions from the dependency list / classpath. Is this possible and if so how?</p>
  
  <hr>
  
  <p>Another issue I discovered is with <code>sbt-assembly</code> with errors like the following (for each duplicate file):</p>
  
  <pre><code>[error] deduplicate: different file contents found in the following:
  [error] /home/wookietreiber/.ivy2/cache/jfree/jfreechart/jars/jfreechart-1.0.12.jar:org/jfree/data/KeyedValues2D.class
  [error] /home/wookietreiber/.ivy2/cache/org.jfree/jfreechart/jars/jfreechart-1.0.17.jar:org/jfree/data/KeyedValues2D.class
  </code></pre>