title: CommandLine inside a loop
body: <p>I'm using a gradle task which executes the command-line inside a file collection loop:</p>
  
  <pre><code>...
  collection.each { file -&gt;
          exec {
              workingDir = file(props['WORKING_DIR']).getAbsolutePath()
              commandLine "java", "-jar", file(props['SIGN_TOOL']).getAbsoluteFile(), file
          }
      }
  ...
  </code></pre>
  
  <p>Unfortunately, the gradle task ends up with this error:</p>
  
  <blockquote>
    <p>Execution failed for task ':signFiles'.</p>
    
    <blockquote>
      <p>No signature of method: java.io.File.call() is applicable for argument types: (java.lang.String) values: Possible
      solutions: wait(), any(), wait(long), each(groovy.lang.Closure),
      any(groovy.lang.Closure), list()</p>
    </blockquote>
  </blockquote>
  
  <p>How can i fix this issue? </p>
  
  <p>Thx MVM</p>