Add mvnlog --web: local web server for interactive build report viewing
- Dominant language
- Java
- Stars
- 5.3k
- Forks
- 3.1k
- Avg merge
- 20h 42m
- Merged PRs (30d)
- 297
Description
## Context
PR #12699 (mvnlog: build log viewer, integration tests, script routing) introduced `mvnlog`, a CLI tool that renders build reports as formatted terminal output. While the terminal output is functional, a web-based viewer would provide a much richer experience for exploring build reports.
## Proposal
Add a `--web` flag to `mvnlog` that starts a lightweight local HTTP server serving an interactive build report viewer:
```bash
mvnlog --web # starts on localhost, auto-opens browser
mvnlog --web --port 8080 # custom port
```
## Implementation Plan
### Server (Java — zero external dependencies)
Use the JDK built-in `com.sun.net.httpserver.HttpServer` (available since Java 6, no additional dependencies):
- **`/`** — serves a single HTML page with inlined CSS + vanilla JS (bundled as a classpath resource)
- **`/api/report`** — returns the raw `build-report.json` content
- **`/api/reports`** — lists available build reports
- **Auto-open** — `java.awt.Desktop.browse(URI)` to open the browser
- **Self-terminating** — shuts down after 30 minutes of inactivity, or Ctrl+C
- **Port selection** — try default port, fall back to random available port if busy
### Frontend (single HTML file — no build step, no framework)
A single `report.html` resource bundled in the Maven distribution, containing:
#### Header
- Status badge (SUCCESS/FAILURE) with color
- Maven version, Java version, start time, total duration
- Goals executed, thread count
#### Module Timeline (Gantt chart)
- Horizontal bars showing parallel module builds
- Color-coded by status (green/red/gray)
- Hover for duration details
- Click to expand mojo breakdown
#### Mojo Detail Panel
- Click a module → see individual mojo executions
- Duration bars with proportional sizing
- Phase grouping (compile, test, package, etc.)
- Expandable log output per mojo
#### Problems Panel
- Filterable by severity (ERROR/WARN/INFO)
- Searchable by message text
- Each problem shows: key, source, suggestion (clickable), documentation URL (clickable link)
- Sortable by severity, source, key
#### Failures Panel
- Stack traces with syntax highlighting
- Module and mojo context
- Collapsible for long traces
#### Log Viewer
- Full build log with virtual scrolling (for large logs)
- Level-based filtering (ERROR/WARN/INFO/DEBUG)
- Module-scoped filtering
- Text search with highlighting
### Design Principles
- **No npm, no webpack, no React** — vanilla HTML/CSS/JS only, bundled as a single file
- **Responsive** — works on mobile (check build status from phone)
- **Dark/light mode** — respects `prefers-color-scheme`
- **Accessible** — proper ARIA roles, keyboard navigation
- **Offline** — everything inlined, no CDN dependencies
- **Small** — target < 50KB for the HTML resource
## Non-Goals (for this issue)
- Real-time streaming of ongoing builds (future enhancement)
- Multi-build comparison/history (future enhancement)
- Persistent server mode (future enhancement)
- Remote access / authentication (future enhancement)
## Depends on
- #12699 (mvnlog: build log viewer, integration tests, script routing)
- #12716 (mvnlog — needs serious rewrite)
Contributor guide
Research direction
Start by reviewing PR #12699 and the work tracked in #12716 to understand the existing mvnlog CLI and build-report format. Then scope the Java HttpServer integration and the bundled report.html resource around the proposed /, /api/report, and /api/reports endpoints. Done means --web supports port selection, browser opening, inactivity shutdown, and an offline interactive viewer covering the listed report panels without external dependencies.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- html, java, javascript
- Domain
- build-system, cli, devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100