title: Running custom gradle task when one module builds
body: <p>I'm confused on where to declare a custom gradle task and how to control when it's run.</p>
  
  <p>I have a project with several modules. In (only) one of them I'd like to execute a script at any point of its build process.</p>
  
  <p>So i have declared the task in the <strong>modules's</strong> build.gradle </p>
  
  <pre><code>task generateAssets(type:Exec) {
  
      commandLine './scripts/generate_assets.sh'
      standardOutput = new ByteArrayOutputStream()
  
      ext.output = {
          return standardOutput.toString()
      }
  }
  </code></pre>
  
  <p>And nothing happens, what I kind of expected, as I suppose I will have to call this task or something like that, but I don't know how.</p>
  
  <p>How can I do it?</p>