title: gradle trigger file copy from another task
body: <p>I have a gradle task which scans the dependant jars and I want to place all the dependant jars in a new directory</p>
  
  <p>Using the ResolvableDependencies API I was able to identify the source and target folders.</p>
  
  <p>below are the example source and target folder</p>
  
  <p>sourcePath</p>
  
  <pre><code>D:\Users\myuserId\.gradle\caches\modules-2\files-2.1\io.netty\netty-handler\4.0.27.Final\91d5c8e25150759bdfce680f318e7b3e8a493b1f
  </code></pre>
  
  <p>targetPath</p>
  
  <pre><code>D:\sourcecode\18_04_2017\my-project\build-repo\io\netty\netty-handler\4.0.27.Final
  </code></pre>
  
  <p>I have the below task in my build.gradle</p>
  
  <pre><code>task myCopy(type: Copy)
  </code></pre>
  
  <p>I am invoking the task like below, but it does not work</p>
  
  <pre><code>myCopy.configure{
    from (sourcePath)
    into (targetPath)
  }
  
  myCopy.execute()
  </code></pre>
  
  <p>I read from another SO post that task cannot be invoked from another task and we need to specify "dependsOn" . But in my case I need to copy files within a loop and the source and target paths are derived based on the conditions in the loop.
   In such case , how can i use the gradle copy method ? Or is there any other way I can copy ?</p>