title: Gradle: custom source set as dependency for the main and test ones
body: <p>I've created custom source set in Gradle project to keep all generated code:</p>
  
  <pre><code>sourceSets {
    generated {
      java {
        srcDir 'src/generated/java'
      }
      resources {
        srcDir 'src/generated/resources'
      }
    }
  }
  </code></pre>
  
  <p>I want to make the result of this source set's code compilation available at compile and run time for <code>main</code> and <code>test</code> source sets.</p>
  
  <p>What's the right semantic way to do it in Gradle?</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>As suggested here: <a href="https://stackoverflow.com/questions/11581419/how-do-i-add-a-new-sourceset-to-gradle">How do I add a new sourceset to Gradle?</a> doesn't work for me, I still get <code>java.lang.ClassNotFoundException</code> when I launch my app (though compilation and unit tests run fine). Here is what I tried:</p>
  
  <pre><code>sourceSets {
    main {
      compileClasspath += sourceSets.generated.output
      runtimeClasspath += sourceSets.generated.output
    }
  
    test {
      compileClasspath += sourceSets.generated.output
      runtimeClasspath += sourceSets.generated.output
    }
  }
  </code></pre>