title: Gradle: Passing variable from one task to another
body: <p>I want to pass a variable from one task to another, in the same build.gradle file. My first gradle task pulls the last commit message, and I need this message passed to another task. The code is below. Thanks for help in advance. </p>
  
  <pre><code>task gitMsg(type:Exec){
      commandLine 'git', 'log', '-1', '--oneline'
      standardOutput = new ByteArrayOutputStream()
      doLast {
         String output = standardOutput.toString()
      }
  }
  </code></pre>
  
  <p>I want to pass the variable 'output' into the task below.</p>
  
  <pre><code>task notifyTaskUpcoming &lt;&lt; {
      def to = System.getProperty("to")
      def subj = System.getProperty('subj') 
      def body = "Hello... "
      sendmail(to, subj, body)
  }
  </code></pre>
  
  <p>I want to incorporate the git message into 'body'. </p>