title: How to generate source files and compile them with gradle
body: <p>I have a gradle build script similar to:</p>
  
  <pre><code>apply plugin: 'war'
  
  task genSources &lt;&lt; {
    // here I generate some java files
  }
  
  // making sure that source files are generated
  // before compilation
  compileJava.dependsOn(genSources)
  </code></pre>
  
  <p>How can I make the files generated in <code>genSources</code> compile along with files in <code>src/main/java</code> during <code>compileJava</code>?</p>