title: gradle: calling java plugin via (file) loop
body: <p>Ive written a simple java-based plugin for gradle. I can get output from it via a simple call:</p>
  
  <pre><code>apply plugin: 'localtest'
  mytest {
    set_filename = 'some/path'
  }
  
  ...
  </code></pre>
  
  <p>And then running via</p>
  
  <pre><code>gradle runTest
  </code></pre>
  
  <p>I want to loop through a folder hierarchy and call the function for every file. Doing so like this:</p>
  
  <pre><code>FileCollection collection = fileTree(dir: '.').include('**/*.java')
  collection.each { File file -&gt;
      println file.path
      mytest { 
         set_filename = file.path
      }
  }
  </code></pre>
  
  <p>If I run this as <code>gradle runTest</code> I get all the files from the directory tree printed but <em>my plugin only gets called for the last file in the list</em>. </p>
  
  <p>This is the first time I've tried to do anything original with gradle so it's very likely I'm making a dumb mistake here.</p>
  
  <p>Suggestions?</p>