Dependency resolution in ant

(Priyanka Gopinath) #1

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){
    from source
    into dest
  task unzip(type: Copy, dependsOn: copyTask){
 into dest
antTask(dependsOn: unzip){
 ant.importBuild 'd:/temp/build.xml'
        dependsOn 'antTask'

(Peter Niederwieser) #2

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.

(Priyanka Gopinath) #3

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

(Peter Niederwieser) #4

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