title: Adding a message or a next line just after completing a task in gradle
body: <p>I have a project with <strong>subprojects projA and projB</strong>.</p>
  
  <p>How can I add a new line just after <strong>executing any task from root project</strong> ?
  What I tried is:</p>
  
  <p>I wrote a task to print next line in commonClosures.gradle file and included it in module gradle files (apply from:). The issue I am facing is, the task runs multiple times when running from root project.</p>
  
  <p><strong>Directory structure:</strong></p>
  
  <pre><code>testPro/
  ├── build.gradle
  ├── gradle
  │   ├── commonClosures.gradle
  │   └── wrapper..
  ├── gradlew
  ├── projA
  │   ├── build.gradle
  │   ├── gradle
  │   │   └── wrapper..
  │   ├── gradlew
  │   └── settings.gradle
  ├── projB
  │   ├── build.gradle
  │   ├── gradle
  │   │   └── wrapper..
  │   ├── gradlew
  └── settings.gradle
  </code></pre>
  
  <p><strong>cat settings.gradle</strong> </p>
  
  <pre><code>rootProject.name = 'testPro'
  include 'projA','projB'
  </code></pre>
  
  <p><strong>cat build.gradle</strong></p>
  
  <pre><code>apply plugin: 'java'
  apply from: 'gradle/commonClosures.gradle'
  </code></pre>
  
  <p><strong>cat projA/build.gradle</strong> </p>
  
  <pre><code>apply plugin: 'java'
  apply from: '../gradle/commonClosures.gradle'
  </code></pre>
  
  <p><strong>cat projB/build.gradle</strong> </p>
  
  <pre><code>apply plugin: 'java'
  apply from: '../gradle/commonClosures.gradle'
  </code></pre>
  
  <p><strong>cat gradle/commonClosures.gradle</strong> </p>
  
  <pre><code>gradle.taskGraph.afterTask { 
      println "task completed"
  }
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>~/workspace/ROOT_PROJECT
  
  ]$ ./gradlew clean
  projA
  :clean UP-TO-DATE
  task completed
  task completed
  task completed
  :projA:clean UP-TO-DATE
  task completed
  task completed
  task completed
  :projB:clean UP-TO-DATE
  task completed
  task completed
  task completed
  
  BUILD SUCCESSFUL
  </code></pre>
  
  <p>is there any simple way to handle this ?</p>