Skip to content

mvnlog --web: local HTTP server for interactive build report viewer - #12885

Draft
gnodet wants to merge 1 commit into
feature/mvnlogfrom
feature/mvnlog-web
Draft

mvnlog --web: local HTTP server for interactive build report viewer#12885
gnodet wants to merge 1 commit into
feature/mvnlogfrom
feature/mvnlog-web

Conversation

@gnodet

@gnodet gnodet commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds web-based build report viewing to mvnlog (addresses #12645), rebased cleanly on the feature/mvnlog PR chain (#12694#12695#12697#12698#12699):

  • --web flag starts a local HTTP server bound to loopback only (not 0.0.0.0)
  • --port configures the server port (default 8080, auto-fallback to random available port)
  • Interactive HTML viewer with filtering, search, and report history
  • Security: path traversal protection via regex + normalize().startsWith() checks
  • Graceful shutdown via CountDownLatch after 30 minutes of inactivity (no System.exit())
  • Auto-opens browser on supported desktops (best-effort, ignored if headless)
  • Build report opt-out via -Dmaven.build.report.skip=true
  • Report directory changed to target/build-reports/ with build-report-latest.json copy

Review feedback addressed (from #12716)

  • Removed Google Fonts CDN links → system font stack
  • Use LogEvent API (event.level().name(), event.timestamp(), event.message()) instead of string parsing
  • Use Collections.synchronizedList(new ArrayList<>()) instead of CopyOnWriteArrayList for performance
  • Fix @since 4.0.0@since 4.1.0 in package-info.java
  • lastRequestTime is an instance field (not static)
  • Added mojoFinished(ExecutionEvent, String) to BuildEventListener interface
  • Updated all implementations and tests for the new interface signatures

Files changed

Area Files
API LogOptions.java (added web(), port()), package-info.java (fixed @since)
CLI CommonsCliLogOptions.java, LogInvoker.java, report.html
Core BuildEventListener.java, BuildReportEventListener.java, LoggingExecutionListener.java, SimpleBuildEventListener.java
Tests MachineBuildEventListenerTest.java, RichBuildEventListenerTest.java

Test plan

  • mvn verify -pl impl/maven-cli -am -DskipTests compiles cleanly (verified locally)
  • mvn test -pl impl/maven-cli -am passes (4 pre-existing MavenInvokerTest failures unrelated to this PR)
  • mvnlog --web starts HTTP server on localhost:8080
  • mvnlog --web --port 9090 uses custom port
  • Port fallback works when preferred port is busy
  • Path traversal attempts return 400 Bad Request
  • Server auto-shuts down after 30 minutes of inactivity
  • -Dmaven.build.report.skip=true prevents report generation
  • Report files written to target/build-reports/

🤖 Generated with Claude Code

@gnodet gnodet added this to the 4.1.0 milestone Aug 28, 2026
@gnodet gnodet added the enhancement New feature or request label Aug 28, 2026
@gnodet
gnodet force-pushed the feature/mvnlog-web branch from a9795c8 to bbad68c Compare August 28, 2026 10:36
… viewer

Adds a --web flag to mvnlog that starts a local HTTP server serving an
interactive single-page build report viewer. The viewer reads from the
existing BuildReportCollector JSON format (flat top-level fields, ISO
timestamps and durations, per-module/per-mojo output arrays).

Features:
- Loopback-only binding for security (localhost only)
- Path traversal protection with regex + normalize()
- Auto-open browser on supported desktops
- Gantt chart timeline of module builds
- Per-mojo execution details with inline log viewing
- Problems table with search, filter, and sort
- Failure details with stack trace highlighting
- Virtual-scrolling full build log viewer
- Light/dark theme via prefers-color-scheme
- 30-minute inactivity auto-shutdown
- Configurable port via --port flag
- System font stack (no external CDN dependencies)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gnodet
gnodet force-pushed the feature/mvnlog-web branch from bbad68c to f9939a9 Compare August 28, 2026 11:18

@elharo elharo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static HTML should be enough. The issue specifically does not ask for a local web server. This is a lot of extra dependencies with additional maintenance burden and security surface. I'm not convinced this carries its weight.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants