What is the `org.gradle.console` property, and how does it relate to the `--console` flag and `--no-color`?
answer
- org.gradle.console = persistent --console
- same values: plain/rich/auto/verbose
- CLI --console overrides the property
- gradle.properties: project then ~/.gradle
- --no-color = color only, no progress-bar suppression
basics
~10 sorg.gradle.console is a Gradle property (set in gradle.properties) that fixes the console mode persistently — same values as --console (plain/rich/auto/verbose). A command-line --console flag overrides it for that run. --no-color only strips color.
solid answer
~40 s`org.gradle.console` is the **persistent** form of the `--console` flag. You set it once in `gradle.properties` — project-level (committed, shared by the team) or in `~/.gradle/gradle.properties` (machine-wide, e.g. on a CI agent) — and it accepts the same values: `plain`, `auto`, `rich`, `verbose`. Precedence: a **command-line `--console` always wins** over the property for that invocation, so a developer can do a one-off `--console=rich` even if the project pins `plain`. `--no-color` is a narrower, orthogonal switch that disables **color only**, leaving the progress bar intact; `--console=plain` disables color *and* the progress bar. So for a fully flat log you choose `plain`, not `--no-color`. Using the property keeps the choice consistent across every run without anyone remembering the flag.
code
toml · 5 lines# gradle.properties
org.gradle.console=plain # persistent mode
# A developer can still override per run:
# ./gradlew build --console=rich (CLI wins for that invocation)go deeper
Know that org.gradle.console sets the console mode in gradle.properties.
State the accepted values, that CLI overrides the property, and that --no-color is color-only.
Explain the project vs GRADLE_USER_HOME resolution and recommend pinning plain for CI while allowing local overrides.
Bake console policy into shared gradle.properties / agent configuration as part of build-environment governance.
## The property and where it lives `org.gradle.console` is one of Gradle's **build environment properties** — the same family as `org.gradle.parallel`, `org.gradle.caching`, `org.gradle.jvmargs`. You declare it in a `gradle.properties` file: ```properties # <repo>/gradle.properties — committed, team-wide org.gradle.console=plain ``` Resolution order for `gradle.properties` (later wins): the project's file, then `GRADLE_USER_HOME` (default `~/.gradle/`) file, then `-D`/environment overrides. So a CI agent can set `org.gradle.console=plain` in `~/.gradle/gradle.properties` to enforce clean logs without editing any repo. ## Accepted values Identical to the flag: `auto` (default — TTY detection), `plain` (no color, no progress bar), `rich` (forced color + progress bar), `verbose` (rich plus a line for every task including UP-TO-DATE). ## Property vs flag precedence The **command-line `--console` overrides the property** for that single invocation. This is the usual Gradle layering: persistent declaration in properties, ad-hoc override on the CLI. Example: project pins `org.gradle.console=plain`, but a developer debugging locally runs `./gradlew build --console=rich` to get colors back, just for that run. ## How --no-color fits `--no-color` is **not** a console mode — it's a focused switch that suppresses ANSI color while leaving the progress/work-in-progress area drawing. There's no `org.gradle.no-color` property; if you want persistent color-free *and* progress-free output, set `org.gradle.console=plain`. Think of it as: - `--no-color` → remove color, keep progress bar - `--console=plain` → remove color **and** progress bar - `org.gradle.console=plain` → the same as plain, but persistent ## Practical guidance - Pin `org.gradle.console=plain` in committed `gradle.properties` (or agent-level) for reproducible CI logs. - Let developers override with `--console=rich`/`auto` locally when they want the live UI. - Reach for `--no-color` only in the niche case where you want to keep the progress bar but drop color.
- If gradle.properties has org.gradle.console=plain but you pass --console=rich, what happens?rich is used for that invocation — the command-line flag overrides the property.
- Is there an org.gradle.no-color property?No. To persistently drop color and the progress bar use org.gradle.console=plain; --no-color is a CLI-only, color-only switch.
- Where can you set the property to enforce it on a CI agent without touching the repo?In ~/.gradle/gradle.properties (GRADLE_USER_HOME) on the agent, which applies to all builds run by that user.
saying these in an interview costs you the question
- Saying the property overrides the command-line flag — it's the reverse.
- Equating --no-color with --console=plain; the former keeps the progress bar.