Skip to content
Latchkey

mvn -B: Batch Mode for CI Logs

mvn -B (--batch-mode) runs Maven non-interactively with plain, line-oriented output and no prompts, which is what CI runners want.

Interactive Maven can prompt and emits carriage-return download progress that clutters CI logs. -B disables both, and -ntp removes transfer noise.

What it does

-B / --batch-mode tells Maven it has no console: it never prompts (e.g. for archetype choices) and disables ANSI color and the animated download progress, printing plain lines instead. Pair it with -ntp (--no-transfer-progress) to drop the per-artifact download lines entirely.

Common usage

Terminal
mvn -B package
mvn -B -ntp verify
mvn --batch-mode --no-transfer-progress clean install

Flags

FlagWhat it does
-B / --batch-modeNon-interactive, plain output, no prompts
-ntp / --no-transfer-progressSuppress download/upload progress lines
--color neverForce-disable ANSI color
-qQuiet: only show errors

In CI

Always run mvn -B -ntp ... in pipelines: it keeps logs readable and prevents a missing-input prompt from hanging the job forever. Combine with caching ~/.m2/repository so there is little transfer noise to suppress in the first place.

Common errors in CI

Without -B, an interactive goal can hang waiting on stdin, showing no error until the job times out; adding -B makes it fail fast or proceed with defaults. If logs still show carriage-return progress, add -ntp (older Maven needs the flag; very old versions use -Dmaven.wagon.transfer.progress=false). -B does not change build results, only output and interactivity.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →