How to use Ant's 'Parallel' target?

Sorry, I didn’t quite get what you meant by “additionally declare your test tasks and Ant tasks”.

Did you mean if I want to use Ant’s ‘Parallel’ task in my build script, I have to give it Ant’s task to execute, instead of Gradle tasks? Something like below:

task runAllTestsByGroups << {
      ant.parallel(threadsPerProcessor: 1) {
                    ant.junit (...) {
            // run test group 1
            ...
        }
          ant.junit(...) {
            // run test group 2
            ...
       }
         // run group 3, 4, 5 ...
    }
  }