title: Conditionally skip subproject in multi-module Gradle build
body: <p>Consider the following Gradle project structure:</p>
  
  <pre><code>- root
  |- build.gradle
  |- barProject
   |- build.gradle
  |- fooProject
   |- build.gradle
  </code></pre>
  
  <p>where the root <strong>build.gradle</strong> configures its subprojects like so:</p>
  
  <pre><code>subprojects {
      apply plugin: 'java'
  
      //bunch of other stuff
  }
  </code></pre>
  
  <p>Now when I call <code>gradlew build</code> on the root project it automatically configures both subprojects and then builds them - all well and good.</p>
  
  <p>I also know that I can skip a specific task with various means (<code>onlyIf()</code>, <code>[taskName].enabled = false</code>, etc.) but when I utilize any of those on <code>build</code> Gradle still runs all the dependent tasks (<code>compileJava</code>, <code>processResources</code>, <code>classes</code>, etc.) until finally hitting <code>build</code> which it then skips.</p>
  
  <p>My question is, is there <em>any way</em> to have Gradle stop and go to the next subproject right after the configuration phase?</p>
  
  <p>EDIT:</p>
  
  <p>To clarify; each subproject has a property called <code>skip</code> that is evaluated in the configuration phase.</p>
  
  <p>Now when I call <code>gradlew build</code> on the root project I want Gradle to, ideally, check that property and if it's true then to <strong>completely skip</strong> the corresponding project.</p>
  
  <pre><code>Executing external task 'build'...
  
  //check project.skip -&gt; IF true -&gt; skip project, go to :foo ELSE continue
  :bar:compileJava
  :bar:processResources UP-TO-DATE
  :bar:classes
  :bar:jar
  :bar:startScripts
  :bar:distTar
  :bar:distZip
  :bar:assemble
  :bar:compileTestJava UP-TO-DATE
  :bar:processTestResources UP-TO-DATE
  :bar:testClasses UP-TO-DATE
  :bar:test UP-TO-DATE
  :bar:check UP-TO-DATE
  :bar:build
  
  //check project.skip -&gt; IF true -&gt; skip project, go to end ELSE continue
  :foo:compileJava
  :foo:processResources UP-TO-DATE
  :foo:classes
  :foo:jar
  :foo:startScripts
  :foo:distTar
  :foo:distZip
  :foo:assemble
  :foo:compileTestJava UP-TO-DATE
  :foo:processTestResources UP-TO-DATE
  :foo:testClasses UP-TO-DATE
  :foo:test UP-TO-DATE
  :foo:check UP-TO-DATE
  :foo:build
  
  BUILD SUCCESSFUL
  </code></pre>
  
  <p>I hope this makes more sense</p>