How can I import build.xml and execute tasks with parameters?

I need to run a couple of ant targets from my gradle task .

ant.importBuild 'd:/temp/build.xml'
      task mytask
{
  dependsOn 'antTarget'
  }

My question is -

  1. Is this the right approach? 2. If this is correct, how do I configure parameters to be passed to this ant target?

p.s - I am new to groovy and totally confused!!

The approach is correct. Generally I’d rather recommend to port the Ant target to Gradle though (reusing some Ant tasks if necessary) because it’s a cleaner approach. As to your second question, there is no such thing as passing parameters to an Ant target. If what you are after is to set an Ant property, you can do this with ‘ant.properties[“some.ant.property”] = “some value”’.

That worked… thanks for the reply !

By porting do you mean rewrite the ant targets using gradle?