Problem Statement
What is the Gradle wrapper and why is it recommended in CI/CD?
Explanation
Gradle Wrapper (gradlew) is a script that downloads and runs specific Gradle version, ensuring build consistency across different environments. Instead of requiring Gradle pre-installed on CI agents, wrapper downloads correct version on first run. This eliminates version mismatch issues and 'works on my machine' problems.
Wrapper consists of gradlew (Unix), gradlew.bat (Windows), gradle/wrapper/gradle-wrapper.jar, and gradle/wrapper/gradle-wrapper.properties specifying Gradle version. Example gradle-wrapper.properties:
```
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
```
CI/CD usage: ./gradlew build ensures same Gradle version used locally and in CI. Commit wrapper files to version control so anyone cloning repository uses correct version. Generate wrapper with gradle wrapper command. Benefits include version consistency, no installation required, explicit version control, easy upgrades (update properties file). Understanding wrapper is crucial for reproducible builds.
