From: Dmitry Fedotov Date: Sat, 13 Apr 2024 15:11:14 +0000 (+0300) Subject: Add Gradle CLI Basics page. X-Git-Url: https://www.git.dmfe.net/?a=commitdiff_plain;h=3a4036e012bb5c5c927943e2761a0eb06401c30c;p=dmfe-website Add Gradle CLI Basics page. --- diff --git a/docs/gradle/core-concepts/cli_basics.md b/docs/gradle/core-concepts/cli_basics.md new file mode 100644 index 0000000..89bd560 --- /dev/null +++ b/docs/gradle/core-concepts/cli_basics.md @@ -0,0 +1,55 @@ +--- +sidebar_position: 3 +tags: + - gradle + - build tool + - cli +--- + +# Command-Line Interface Basics + +CLI is the primary method of **inrecacting with Gradle**. +Executing Gradle on the command line conforms to the following structure: +```bash +gradle [taskName...] [--option-name...] +``` + +Options are allowed _before_ and _after_ task names: +```bash +gradle [--option-name...] [taskName...] +``` + +Multiple tasks should be separated by space: +```bash +gradle [taskName1 taskName2...] [--option-name...] +``` + +Options that enable behavior have long-form options with inverses specified with `--no-`: +```bash +gradle [...] --build-cache +gradle [...] --no-build-cache +``` + +Some long-form options have short-options equivalents: +```bash +gradle --help +gradle -h +``` + +## Command-Line usage + +### Executing tasks + +To execute a task called `taskName` on the root project: +```bash +$ gradle :taskName +``` +This will run the single task `taskName` and all of its dependencies. + +### Specify options for tasks + +To pass an option to a task, prefix the option with `--` after the task name: +```bash +$ gradle taskName --exampleOption=exampleValue +``` +