Best practice to reuse ant for Gradle build?

(dusiabh) #1

My current ant build contains about 50 task in the build.xml. How I can reuse the current ant build for Gradle build.

 <target name="pack1"/>
 <target name="pack2"/>
 <target name="packN"/>
ant.importBuild 'build.xml'

I can run build like that: gradle pack1 etc How I can run the build for all tasks?

(Peter Niederwieser) #2

If there is a best practice, it’s not to use ‘ant.importBuild’ and only reuse Ant tasks (and only when there is no Gradle equivalent). Otherwise you’ll be missing out on many of Gradle’s advantages. Also, ‘ant.importBuild’ has known limitations.

How I can run the build for all tasks?

You can do something like:

task packAll {

dependsOn tasks.matching {“pack”) }


(dusiabh) #3

Thank you!