I am new to Gradle and Gradle Wrapper and I am confused about what Gradle Wrapper does.
As stated in the official website, there are two benefits from Gradle Wrapper:
- Standardizes a project on a given Gradle version, leading to more reliable and robust builds.
- Provisioning a new Gradle version to different users and execution environment (e.g. IDEs or Continuous Integration servers) is as simple as changing the Wrapper definition.
which I agree.
However, as I see it, we do not need a new thing (Gradle Wrapper) to gain these benefits. A simple script could do the same thing, something like this
# 1. download Gradle zip file of specific version # 2. unzip the downloaded file to specific location (e.g., ~/.gradle/wrapper) # 3. activate the gradle using environment variable (adding new gradle executables to PATH)
With this script, I believe we can do anything that Wrapper does.
I haven’t found a convincing answer for this, really appreciate if someone could share some insights.
I also open a question here: java - Why is Gradle Wrapper needed? - Stack Overflow.