How to avoid ant like scripting?

I have a fairly simple requirement:

  1. Copy some dependencies to $buildDir/staging folder 2) zip the content of $buildDir/staging folder 3) Call a java class with the above folder as argument.

So far I am using this script:

// Copy the dependencies
task myPrepare << {
  copy {
    from configurations.myConf
    into new File("$buildDir/staging").getPath()
  }
}
  // Zip the folder
task myAssemble(dependsOn: 'myPrepare', type: Zip){
  from "$buildDir/staging"
}
  // Call the java class
task myDeploy(dependsOn: 'myAssemble') << {
    javaexec {
      classpath = sourceSets.main.runtimeClasspath
      main = 'com.test.MyClass'
      args=["$buildDir/distributions"]
    }
}

but this smells very much like ant and maybe there is a more gradle way to achieve the rather basic steps described above?

Basically it comes from the problem that zip cannot be called from a task like copy.

Whenever possible, you should prefer the ‘Copy’ and ‘JavaExec’ task types over the corresponding methods (also here). Instead of having a staging directory, the ‘myAssemble’ task should pull in files from their original locations (e.g. ‘from configurations.myConf’). This eliminates the need for the ‘myPrepare’ task. If the latter were to stay, ‘into new File("$buildDir/staging").getPath()’ could be simplified to ‘into “$buildDir/staging”’.