title: Run all subprojects tests using Gradle
body: <p>I have a multi-module android project with the structure:</p>
  
  <pre><code>:a
  :b
    :c
    :d
      :e
  </code></pre>
  
  <p>I'm trying to run a jacoco report on module :b so that it runs on :b, :c, :d, and :e without running :a.  I want all of the xml reports to be in a common folder with names of their project.xml (e.g. b.xml, c.xml, etc.)  I have a pretty standard jacoco setup</p>
  
  <pre><code>task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest', 'createDebugCoverageReport']) {
  
      reports {
          xml.enabled = true
          xml.destination = file(allTestCoverageDir + project.name + ".xml")
          html.enabled = true
      }
  
      def fileFilter = [
              '**/R.class',
              '**/R$*.class',
              '**/BuildConfig.*',
              '**/Manifest*.*',
              '**/*Test*.*',
              'android/**/*.*',
  
              //Dagger 2
              '**/*Dagger*Component*.*',
              '**/*Module.*',
              '**/*Module$*.*',
              '**/*MembersInjector*.*',
              '**/*_Factory*.*',
              '**/*Provide*Factory*.*',
      ]
  
      def kotlinDebug = [fileTree(dir: "${project.buildDir}/tmp/kotlin-classes/debug", excludes: fileFilter)]
      def mainSrc = files([
              "$project.projectDir/src/main/java",
              "$project.projectDir/src/main/kotlin"
      ])
  
      sourceDirectories = files([mainSrc])
      classDirectories = files(kotlinDebug)
      executionData = fileTree(dir: project.buildDir, includes: [
              'jacoco/testDebugUnitTest.exec', 'outputs/code-coverage/connected/*coverage.ec'
      ])
  }
  </code></pre>
  
  <p>But when I try to loop through subprojects in a doLast block, the doLast block never runs and trying to access subprojects before that also shows that :a has no subprojects.</p>
  
  <p><strong>Edit</strong> I am able to run these for each sub project with ./gradlew b:jacocoTestReport or ./gradlew c:jacocoTestReport and all the reports and in a folder with the correct names.  But as my project grows I don't want to have to run dozens of commands (one for each module) I want a single command ./gradlew b:jacocoTestReport (or something similar) which runs for b and it's subtree</p>