See gradle/gradle#11914 for some details. With thanks to @wolfs for the suggestion, we should be able to fix this by running Ant using a JavaExec task so that we can get the necessary dependencies on Ant's classpath without messing with one of Gradle's own class loaders.