Gradle wrapper upgrade failure

I’m trying to upgrade the gradle wrapper version in our project (6.8.3->6.9.2), however I’m running into a weird error:

zchovan@zoltan-7000-ubuntu:~/kudu/java$ gradle wrapper --gradle-version 6.9.2
Parallel execution is an incubating feature.

> Task :buildSrc:compileGroovy FAILED
/home/zchovan/kudu/java/buildSrc/src/main/groovy/org/apache/kudu/gradle/DistTestTask.java:33: error: package org.gradle.api.tasks.options does not exist
import org.gradle.api.tasks.options.Option;
                                   ^
/home/zchovan/kudu/java/buildSrc/src/main/groovy/org/apache/kudu/gradle/DistTestTask.java:83: error: cannot find symbol
  @Option(option = "classes",
   ^
  symbol:   class Option
  location: class DistTestTask
/home/zchovan/kudu/java/buildSrc/src/main/groovy/org/apache/kudu/gradle/DistTestTask.java:103: error: cannot find symbol
  @Option(option = "collect-tmpdir",
   ^
  symbol:   class Option
  location: class DistTestTask
/home/zchovan/kudu/java/buildSrc/src/main/groovy/org/apache/kudu/gradle/DistTestTask.java:303: error: method does not override or implement a method from a supertype
    @Override
    ^
4 errors
startup failed:
Compilation failed; see the compiler error output for details.

1 error



FAILURE: Build failed with an exception.

If I run a simple gradle build command, the project compiles fine and there is no similar error. I tried to find if the Option class/annotation has changed or has been deprecated but I wasn’t able to find anything related. As far as I found the class exists and hasn’t been changed.

Any ideas what might be going wrong?

Thanks!

You are not using the Gradle wrapper to call the wrapper task, but a locally installed version.
Your build seems to not be compatible with that installed version.
I’d recommend to uninstall any locally installed Gradle version to never risk to accidentally use it.
You should always use the Gradle wrapper to build a project as that uses the Gradle version the build is designed for and known working with.