Skip to content

Add mvnlog --web: local web server for interactive build report viewing #12645

Description

@gnodet

Context

PR #12572 (Build Report Foundation) 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:

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-openjava.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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions