How to migrate ANT build files to Gradle build file with any automation suite

I want suggestion for the below requirement:
I have got requirement where around 1000 application are there based on ANT build file. We would want to convert those ANT file to Gradle. This is not like only invoking build.xml using antBuilder and use , we want to convert task mentioned in ANT build.xml into Gradle build.gradle file. Every task of xml should automatically convert into gradle task accordingly.
Please suggest how should I proceed? I have tried with some tool using java language to parse those xml then re write in gradle task but that is not build independent.
Please suggest the way to start such activity.
Thanks in advance.

You can import build.xml files into a Gradle build. Effectively, that turn an Ant target into a Gradle task: https://docs.gradle.org/current/userguide/ant.html#sec:import_ant_build. If you are planning to implement some sort of converter tool, then Iā€™d suggest you have a look at the code in Gradle core for that functionality. At the moment Gradle does not provide the same conversion support as it does for Maven.

Thanks Benjamin,
Yes actually I am trying to make a task converter tool.
If Gradle has this feature for Maven , can you suggest me the place where I can collect the info.
It might be useful for me in terms of ANT tasks conversion as basically both are XML files.

Have you been able to make that tool? I too want to convert a lot of Ant build files to Gradle.

Ya I ended up with the same approach given initially. Used java DOM parser technique to take each xml file and based on the given ANT target (xml tag) I put my equivalent gradle task in gradle template. So separately had to search a gradle task for given ANT target and put that in place in my template at desired location.

1 Like

Do you have a working example for your changes? It will help me to generate one?

Hi @gdshukla
Were you able to create a converter for this task. I need to do something of that sort for projects in my team as well.

Hello@gdshukla ! Were you able to accomplish the task ? I have same sort of requirement in my project too. If you could suggest to proceed further.

Thanks in advance.