Dependency resolution in ant

This is what I need to achieve -

  1. Copy a zip file from network 2. Unzip the contents 3. run an ant command

To run the ant command I need the build.xml that is created only after unzipping the folder. So when I try to import the buil.xml, the gradle build keeps failing. -

A problem occurred evaluating root project ‘gradle’. > Could not import Ant build file ‘D:\temp\build.xml’.

What is the workaround this problem?

task copyTask(type: Copy){
     mkdir('d:/temp/')
    from source
    into dest
 }
  task unzip(type: Copy, dependsOn: copyTask){
 from(zipTree(zipFile))
 into dest
}
  task
antTask(dependsOn: unzip){
 ant.importBuild 'd:/temp/build.xml'
        dependsOn 'antTask'
}

There is no easy solution, as ‘ant.importBuild’ has to occur in the configuration phase, before any tasks have been executed. I’d consider shelling out to Ant instead.

Could you please elaborate on "shelling out to Ant "? I am not sure what you mean by that.

What I mean is calling out to Ant via an ‘Exec’ task.