title: Create A Directory Before Several Gradle Tasks
body: <p>I have several tasks that require a sub-directory of <code>build</code> to exist.</p>
  
  <p>What is the best way to achieve this? </p>
  
  <p>So far I have this:</p>
  
  <pre><code>afterEvaluate {
      mkdir "$buildDir/work"
  }
  </code></pre>
  
  <p>And this:</p>
  
  <pre><code>task prepareDirs {
      mkdir "$buildDir/test"
  }
  </code></pre>
  
  <p>The second one works because it is run in the configuration phase and so I don't need to put dependsOn on all the tasks that require it.</p>
  
  <ul>
  <li>Are there other options? </li>
  <li>Is <code>mkdir</code> even the right way to do it?</li>
  <li>At what point is the <code>buildDir</code> created? Can I extend that task?</li>
  </ul>
  
  <p>EDIT: I noticed that both of these fail if I chain the clean task on the command line before  my main tasks.</p>