No we can not replace or remove the shipped/provided Groovy that comes with Gradle as:
● Gradle's build language is based on Groovy
● Parts of Gradle are implemented in Groovy
So Gradle is effectively tied to whatever version of Groovy it was shipped with for that release. If the project requirement is of different version or requires Groovy in general, then this needs to be explicitly declare as Groovy dependency. Below is the code snippet:
dependencies { implementation "org.codehaus.groovy:groovy-all:3.0.4" }