From 6735dfedef79649aee37adfc58319b3460372c1a Mon Sep 17 00:00:00 2001 From: Dmitry Fedotov Date: Sat, 13 Apr 2024 11:42:14 +0300 Subject: [PATCH] Add Gradle Wrapper basicis page. --- docs/gradle/basics.md | 3 ++ docs/gradle/core-concepts/gradle_basics.md | 4 ++ .../core-concepts/gradle_wrapper_basics.md | 48 +++++++++++++++++++ 3 files changed, 55 insertions(+) create mode 100644 docs/gradle/core-concepts/gradle_wrapper_basics.md diff --git a/docs/gradle/basics.md b/docs/gradle/basics.md index ca98579..07e51ca 100644 --- a/docs/gradle/basics.md +++ b/docs/gradle/basics.md @@ -1,5 +1,8 @@ --- sidebar_position: 1 +tags: + - gradle + - build tool --- # Why Gradle diff --git a/docs/gradle/core-concepts/gradle_basics.md b/docs/gradle/core-concepts/gradle_basics.md index cca2232..d78d2b6 100644 --- a/docs/gradle/core-concepts/gradle_basics.md +++ b/docs/gradle/core-concepts/gradle_basics.md @@ -1,5 +1,9 @@ --- sidebar_position: 1 +tags: + - gradle + - build tool + - basics --- # Gradle Basics diff --git a/docs/gradle/core-concepts/gradle_wrapper_basics.md b/docs/gradle/core-concepts/gradle_wrapper_basics.md new file mode 100644 index 0000000..fc4fedc --- /dev/null +++ b/docs/gradle/core-concepts/gradle_wrapper_basics.md @@ -0,0 +1,48 @@ +--- +sidebar_position: 2 +tags: + - gradle + - build tool + - wrapper +--- + +# Gradle Wrapper Basics + +Gradle wrapper is the recommended way to execute Gradle build. +The Wrapper script downloads a declared version of Gradle if necessary and execute it. +```mermaid +flowchart LR + gb[Gradle Build] -- 1. Download distribution --> srv[Server] + gb -- 2. Store and unpack distribution --> gh[Gradle User Home] + gh -- 3. Use distribution --> gb +``` + +The Wrapper is available as a `gradlew` or `gradlew.bat` file and provides the following benefits: +- Standardizes a project on a given Gradle version. +- Provisions the same Gradle version for different users. +- Provisions the same Gradle version for different execution environments. + +## Using the Gradle Wrapper + +It is always recommended to execute a build with the Wrapper. +Depending on the operation system, you use `gradlew` or `gradlew.bat` script. +Gradle invocation: +```bash +$ gradle build +``` + +To run the Wrapper: +```bash +$ ./gradlew build # Linux or OSX +$ .\gradlew.bat build # Windows +``` + +Demo of using the Wrapper on a Linux machine for a Java-based project: +```bash +./gradlew build +Downloading https://services.gradle.org/distributions/gradle-8.2.1-bin.zip +............10%............20%............30%.............40%............50%............60%............70%.............80%............90%............100% + +BUILD SUCCESSFUL in 26s +7 actionable tasks: 7 executed +``` -- 2.39.5