title: How to control the order of child project Gradle tasks from root build?
body: <p>I have a Gradle project with two subprojects:</p>
  
  <ul>
  <li><code>backend</code></li>
  <li><code>frontend</code></li>
  </ul>
  
  <p>I want to create a task in the parent project called <code>stage</code> which executes <code>:backend:build</code> but only after running <code>:frontend:clean</code> and <code>:backend:clean</code>.</p>
  
  <p>I tried this but the <code>mustRunAfter</code> is ignored and the cleaning happens at the end of the build instead. What is wrong with it?</p>
  
  <pre><code>task stage(dependsOn: [':frontend:clean', ':backend:clean', ':backend:build'])
  task(":backend:build").mustRunAfter(":frontend:clean", ":backend:clean")
  </code></pre>
  
  <p>I also tried replacing the second line with:</p>
  
  <pre><code>project("backend").build.mustRunAfter(":frontend:clean, ":backend:clean")
  </code></pre>
  
  <p>but still no luck.</p>