apache / apache/maven

Redesign Maven console output: smart terminal, log file, structured summaries

Open
#11,819 2 comments 6 reactions 0 assignees View on GitHub
enhancement
Dominant language
Java
Stars
5.3k
Forks
3.1k
Avg merge
20h 42m
Merged PRs (30d)
297

Description

## Summary

Maven's current console output is excessively verbose and makes it hard to find relevant information. In large multi-module builds (100+ modules), users are overwhelmed with noise — plugin execution banners, download progress lines, and repetitive separators — while actual warnings and errors get buried.

This proposal redesigns Maven's default console output to be concise, informative, and modern, inspired by tools like maven-daemon (mvnd), Gradle, and Cargo.

## Related Issues

- #8571 (MNG-6662): More concise logging — suppress mojo-level output
- #8027 (MNG-7008): Skip reactor logging — error messages buried in huge reactor output
- #8973 (MNG-7941): Meaning of -ntp vs --batch-mode — cleaner separation of output controls
- #11088: CI env variable defaults — auto-detect CI and adjust output
- #8976 (MNG-7484): Warning summary at end of build — surface warnings that get buried
- #7500 (MNG-5932): Per-user/project logging configuration
- #10872 (MNG-8071): Build in parallel by default — output must handle concurrent modules

## Proposal

### Mode 1: Smart/Rich Terminal Output (default when interactive TTY)

Using JLine (already a dependency), Maven uses a **fixed-bottom status area** with scrolling log above:

```
✓ my-core 1.2s
✓ my-api 0.8s
Building my-app 2.0.0 [3/12]
✓ maven-clean-plugin:clean 0.1s
✓ maven-resources-plugin:resources 0.3s
● maven-compiler-plugin:compile 1.2s
↓ junit-jupiter-api-5.10.jar 234/512 KB

────────────────────────────────────────────────────────────────────
my-core ✓ my-api ✓ my-utils ✓ my-app ● my-web ⏳ [5/12] 32s
```

Key principles:
- **Fixed status bar** at the bottom showing currently building modules (parallel-aware), overall progress, elapsed time
- **Compact per-module output** — module name, plugin goals completing (✓/✗), timing
- **Downloads shown inline** with progress, then cleared when done
- **Warnings/errors always bubble up** — never scrolled away
- **Full log written to `target/build.log`** automatically

### Mode 2: CI/Batch Output (default when `CI` env var set or `--batch-mode`)

```
[INFO] Building my-core 2.0.0 [1/12]
[INFO] Building my-api 2.0.0 [2/12]
[WARN] my-utils: maven-compiler-plugin: source/target 8 is deprecated
[INFO] Building my-app 2.0.0 [4/12]
[ERROR] my-app: maven-compiler-plugin:compile FAILED (1.2s)

── Build Summary ──────────────────────────────────────────────────
my-core ..................... SUCCESS [ 1.2s]
my-api ...................... SUCCESS [ 0.8s]
my-utils .................... SUCCESS [ 2.1s] ⚠ 1 warning
my-app ...................... FAILURE [ 1.2s]

── Warnings ───────────────────────────────────────────────────────
my-utils: source/target 8 is deprecated, use 11+

── Error ──────────────────────────────────────────────────────────
my-app: compilation failure (3 errors)
src/main/java/App.java:42: cannot find symbol

BUILD FAILURE Total: 12.3s
Full log: target/build.log
```

### Mode 3: Verbose (`-X` / `--verbose`)

Same as current Maven output — full scrolling output for debugging.

## Design Choices

1. **Default to less, not more** — most users only care about: what's building, did it succeed, and if not, what failed
2. **Log file by default** — all `[INFO]`-level plugin output goes to a log file. Console shows only progress + warnings + errors
3. **Structured warnings/errors at the end** — surfaces warnings that get buried in hundreds of lines (#8976)
4. **Parallel-aware** — with parallel builds (#10872), the status bar shows multiple concurrent modules like mvnd does
5. **Progressive disclosure** — `mvn` (concise) → `mvn --verbose` (full mojo output) → `mvn -X` (debug)

## Implementation Notes

Building blocks already exist in the codebase:
- **JLine** is already a dependency (`maven-jline`)
- **`ExecutionEventLogger`** captures all lifecycle events
- **`ConsoleMavenTransferListener`** does `\r`-based progress
- **`CIDetector`** classes detect CI environments
- **mvnd's `TerminalOutput`** provides a proven reference implementation

The core change: a new `SmartExecutionEventLogger` using JLine's `Display` API to manage a fixed status region, while delegating full output to a file-based log writer.

Contributor guide

Open the contributing guide

Research direction

Start by reading the existing ExecutionEventLogger, ConsoleMavenTransferListener, and CIDetector classes, then compare mvnd's TerminalOutput reference. Define the scope and design for the proposed SmartExecutionEventLogger before implementation; done would require agreed interactive, CI/batch, and verbose output behavior, including summaries and full-log handling.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.