The Gradle wrapper isn’t a validation mechanism. The idea is that everyone uses the wrapper (gradlew) to run builds. Then he automatically gets the version specified in the build script and doesn’t have to install anything.
This is good to try things out with different versions of gradle, but you still have to install some gradle version initially and then finally install correct gradle persistently (system wide).
Only the person that updates the wrapper files (which is rarely needed) needs to have Gradle installed. All others will use the wrapper exclusively. This means that all it takes to upgrade everyone (devs, CI, etc.) to a new Gradle version is to edit gradle-wrapper.properties and commit it to source control.
If you prefer a version check, you can easily implement it yourself:
def minGradleVersion = "1.0-milestone-7"
if (GradleVersion.current() < GradleVersion.version(minGradleVersion)) {
throw new GradleException("Need Gradle version $minGradleVersion or higher")
}
You can turn this into a script or binary plugin for easy reuse.
I understand now, so gradle/wrapper/gradle-wrapper.* is supposed to be committed for it to be used by script. How can it be shared along with gradlew script between modules?
Thanks for the version check snipped - his is something I can use. Would be nice to have this check applied in declarative way (have it as built-in plugin) to match maven prerequisites plugin.
gradle/wrapper/gradle-wrapper.* is supposed to be committed for it to be used by script. How can it be shared along with gradlew script between modules?
The wrapper files only exist once per build, below the root project.