diff --git a/x-pack/plugin/stack/build.gradle b/x-pack/plugin/stack/build.gradle index 7e19f988eacc6..6b26373c40544 100644 --- a/x-pack/plugin/stack/build.gradle +++ b/x-pack/plugin/stack/build.gradle @@ -23,10 +23,10 @@ dependencies { } // These tests are only invoked direclty as part of a dedicated build job -tasks.named('javaRestTest').configure { +tasks.named('javaRestTest').configure {task -> onlyIf("E2E test task must be invoked directly") { - gradle.startParameter.getTaskNames().contains(this.path) || - (gradle.startParameter.getTaskNames().contains(this.name) && gradle.startParameter.currentDir == project.projectDir) + gradle.startParameter.getTaskNames().contains(task.path) || + (gradle.startParameter.getTaskNames().contains(task.name) && gradle.startParameter.currentDir == project.projectDir) } }