title: How to exclude dependency from compile but not from testCompile
body: <p>I have a transitive compile dependency on old version of library testX. Library testX is not supposed to be compile dependency but testCompile dependency. What's more I'd like to depend on testX's newer version, not the older one.</p>
  
  <p>I have a partial solution, which sets correct version of library but it works by overriding compile dependency. But I'm left with unwanted textX in compile.</p>
  
  <pre><code>compile group: 'x', name: 'testX', version 'new'
  </code></pre>
  
  <p>I tried excluding library testX from compile and adding explicit testCompile dependency but the exclude also removes dependencies from testCompile.</p>
  
  <pre><code>testCompile group: 'x', name: 'testX', version 'new'
  
  configurations {
      compile.exclude group: 'x', module: 'X'
  }
  </code></pre>