How to invoke ant target from with a task?


(binyan357) #1

I would like to do something like

ant.importBuild 'build-foo.xml'
  compile {
    inputs.files inputFiles
    outputs.dir "$projectDir/build/reporting/dist"
          doLast {
        // invoke an ant target here
    }
}

Is this possible?


(Benjamin Muschko) #2

You could do the following:

compile.finalizedBy yourAntTarget

(binyan357) #3

That works but the ant target is always called. The inputs and outputs should prevent the compile task from executing when it doesn’t need to. So I need the ant target to only be called when the compile task is executed.