title: Gradle - add dependency to tests of another module
body: <p>I have a multi-module gradle project that looks like this:</p>
  
  <pre><code>Parent
  |--server
  |--application (android module)
  +--common
  </code></pre>
  
  <p>The server tests have a dependency on the common module tests. For this, I added</p>
  
  <pre><code>testCompile files(project(':common').sourceSets.test.output.classesDi
  compileTestJava.dependsOn tasks.getByPath(':common:testClasses')
  </code></pre>
  
  <p>and it worked great. Unfortunately, when I tried to do the same thing for the application module that also has a dependency on the common module tests, it wouldn't work. It fails with:</p>
  
  <pre><code>Build file 'application\build.gradle' line: 103
  A problem occurred evaluating project ':application'.
   Could not find property 'sourceSets' on project ':common'
  </code></pre>
  
  <p>After googling a bit I also tried</p>
  
  <pre><code> project.evaluationDependsOn(':common')
      testCompile files(project(':common').sourceSets.test.output.classesDir)
  </code></pre>
  
  <p>But fails with another exception:</p>
  
  <pre><code>Project application: Only Jar-type local dependencies are supported. Cannot handle: common\build\classes\test
  </code></pre>
  
  <p>Any ideas on how to fix this?</p>