Gradlew and gradlew.bat files change after upgrade

I was going throw the Gradle upgrade guide, we upgraded Gradle from version 5.6.4 to 6.9.1.

When I was running the command gradlew.bat wrapper --gradle-version 6.9.1 we also got changes done to the gradlew, gradlew.bat and gradle-wrapper.jar files.

Is there a reason for those changes?
I initially thought that those changes are necessary by the script that was run. I tried to run the same command on a UNIX-based system with the gradlew (not the gradlew.bat) script for the same project and I didn’t get those changes.
Strangely enough, I tried to re-run it again with windows and the changes weren’t applied. I’m not sure how to reproduce it again.

Attached are the changes for the gradlew and gradlew.bat files, the gradle-wrapper.jar is changes are not visible since it’s an artifact.


The wrapper files do change as platforms change to improve performance and support as many different systems as possible out of the box. The wrapper task writes out the JAR and script files shipped with the version of Gradle that is executing (not the version you’re moving to). You will not see a change if you are running the wrapper task with the same version you already have or a version that no modifications since you last ran it (this is most of the time).

Note that when you run gradlew.bat wrapper --gradle-version 6.9.1 the first time, Gradle 5.6.4 executes the wrapper task and updates the properties to use 6.9.1 going forward. You have to run it a second time to actually get the wrapper files that ship with 6.9.1. You can run newer versions of Gradle with older wrapper files as long as your system was not one that changes were made to support.

However, these changes are not unexpected and the wrapper files are intentionally kept small. Updating them is not strictly required, but changes are made to make specific compatibility or performance improvements.