diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/AntTask.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/AntTask.groovy
index 0393e7632bb..73df8ddbffa 100644
--- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/AntTask.groovy
+++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/AntTask.groovy
@@ -25,9 +25,11 @@ import org.apache.tools.ant.DefaultLogger
import org.apache.tools.ant.Project
import org.gradle.api.DefaultTask
import org.gradle.api.GradleException
+import org.gradle.api.file.FileSystemOperations
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.TaskAction
+import javax.inject.Inject
import java.nio.charset.Charset
/**
@@ -43,6 +45,11 @@ public abstract class AntTask extends DefaultTask {
*/
public final ByteArrayOutputStream outputBuffer = new ByteArrayOutputStream()
+ @Inject
+ protected FileSystemOperations getFileSystemOperations() {
+ throw new UnsupportedOperationException();
+ }
+
@TaskAction
final void executeTask() {
AntBuilder ant = new AntBuilder()
diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/precommit/LicenseHeadersTask.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/precommit/LicenseHeadersTask.groovy
index 81894695190..e24bb9b1499 100644
--- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/precommit/LicenseHeadersTask.groovy
+++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/precommit/LicenseHeadersTask.groovy
@@ -35,7 +35,7 @@ import java.nio.file.Files
*
* This is a port of the apache lucene check
*/
-public class LicenseHeadersTask extends AntTask {
+class LicenseHeadersTask extends AntTask {
@OutputFile
File reportFile = new File(project.buildDir, 'reports/licenseHeaders/rat.log')
diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/precommit/PrecommitTasks.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/precommit/PrecommitTasks.groovy
index 98863224daa..2747b238377 100644
--- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/precommit/PrecommitTasks.groovy
+++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/precommit/PrecommitTasks.groovy
@@ -28,7 +28,7 @@ class PrecommitTasks {
/** Adds a precommit task, which depends on non-test verification tasks. */
- public static void create(Project project, boolean includeDependencyLicenses) {
+ static void create(Project project, boolean includeDependencyLicenses) {
project.pluginManager.apply(CheckstylePrecommitPlugin)
project.pluginManager.apply(ForbiddenApisPrecommitPlugin)
diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/AntFixture.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/AntFixture.groovy
index 6650463a5c5..3d8258eca9d 100644
--- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/AntFixture.groovy
+++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/AntFixture.groovy
@@ -96,7 +96,10 @@ class AntFixture extends AntTask implements Fixture {
@Override
protected void runAnt(AntBuilder ant) {
- project.delete(baseDir) // reset everything
+ // reset everything
+ getFileSystemOperations().delete {
+ it.delete(baseDir)
+ }
cwd.mkdirs()
final String realExecutable
final List