Trying to override old definition of datatype

Hi,

I’m adding an optional ant task to my build.gradle file and I’m getting

Trying to override old definition of datatype...

It seems that there is a better way to add optional ant tasks to gradle.
Does anyone know how to do it?

I’m following https://docs.gradle.org/current/userguide/ant.html#sec:using_custom_ant_tasks

Thanks