Sub project not importing ant script correctly

I am new to Gradle and trying to build a multi-project script. Some of our existing software are deployed via Ant and I would like to use that from my Gradle script. The code I am trying to run from build.gradle is as following:

//Deploy services
project(':services') {
  task buildMe(){
    ant.properties.baseDir='services/id_services/'
    ant.importBuild('services/id_services/build.xml')
  }
}

When I execute this task in sub project’s context e.g. services:buildMe, it throws a BaseDir error. In ant’s build.xml file the baseDir is set to ‘.’

When I copy this code outside this subproject and and execute it without sub project context, then it seems to be working fine and executes the ant script correctly.

Can anyone review and let me know if I am missing anything. I also tried baseDir with ant.properties.baseDir = rootProject.file(‘services/php/db_services/’) in sub project context but it didn’t work.