Skip to content

mvnlog: build log viewer, integration tests, script routing - #12699

Open
gnodet wants to merge 1 commit into
feature/warning-modefrom
feature/mvnlog
Open

mvnlog: build log viewer, integration tests, script routing#12699
gnodet wants to merge 1 commit into
feature/warning-modefrom
feature/mvnlog

Conversation

@gnodet

@gnodet gnodet commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Part 5 of the logging feature chain. Depends on #12698 (warning mode).

Adds the mvnlog tool — a CLI viewer for build-report JSON files — plus integration tests for the entire feature set and script routing.

mvnlog viewer

  • mvnlog / mvnlog --json — view the latest build report as human-readable or raw JSON
  • BuildReportRenderer — renders reports with ANSI colors, timing, failure details
  • SimpleJsonReader — dependency-free streaming JSON parser
  • LogInvoker / LogParser / LogContext — invoker chain for the tool
  • CommonsCliLogOptions / LogOptions — CLI option parsing
  • MavenLogCling — entry point class

Script routing

  • mvn --log routes to MavenLogCling (both mvn and mvn.cmd)
  • Script argument stripping prevents --log from colliding with --log-file prefix matching
  • mvnlog / mvnlog.cmd shell scripts for direct invocation
  • component.xml updated to include mvnlog in the distribution

Integration tests

  • MavenITgh12571BuildReportTest — 8 IT tests covering build report JSON, console modes (plain/machine/verbose), warning mode, version info on failure, and mvnlog viewer
  • 11 existing ITs updated with --console=verbose to preserve expected output format
  • IT test resources (single module + multi-module project POMs)

Files changed (36 files, ~2500 insertions)

Area Files
API Tools.java, LogOptions, ParserRequest
Entry point MavenLogCling
Invoker LogInvoker, LogParser, LogContext, CommonsCliLogOptions
Renderer BuildReportRenderer, SimpleJsonReader
Shell BuiltinShellCommandRegistryFactory (mvnlog command)
Scripts mvn, mvn.cmd, mvnlog, mvnlog.cmd, component.xml
CLI CommonsCliOptions (+--log constant/option)
Tests BuildReportRendererTest, SimpleJsonReaderTest
ITs MavenITgh12571BuildReportTest + 11 existing ITs + 4 resource POMs

PR chain

# PR Feature
1 #12694 Logging foundation
2 #12695 Build report
3 #12697 Console modes
4 #12698 Warning mode + diagnostics
5 This PR mvnlog viewer
6 #12702 Structured problems pipeline
7 #12714 TRACE level migration

Test plan

  • mvn compile — clean compile
  • mvn test -pl impl/maven-cli — all tests pass
  • CI validation

🤖 Generated with Claude Code

@gnodet
gnodet force-pushed the feature/warning-mode branch from 0cc76eb to 6124231 Compare August 8, 2026 01:23
@gnodet
gnodet force-pushed the feature/warning-mode branch 2 times, most recently from dc3bccd to a7c83db Compare August 8, 2026 12:14
@gnodet
gnodet force-pushed the feature/warning-mode branch from a7c83db to 7243fd7 Compare August 8, 2026 19:17
@gnodet
gnodet force-pushed the feature/warning-mode branch from 7243fd7 to af945c2 Compare August 8, 2026 19:35
@gnodet
gnodet force-pushed the feature/warning-mode branch from af945c2 to 850a04c Compare August 8, 2026 21:48
@gnodet
gnodet force-pushed the feature/mvnlog branch 2 times, most recently from 9924a43 to 4d7e49f Compare August 8, 2026 21:57
- mvnlog / mvnlog --json CLI viewer for build-report JSON files
- BuildReportRenderer with ANSI colors, timing, failure details
- SimpleJsonReader dependency-free streaming JSON parser
- mvn --log routes to MavenLogCling, mvnlog shell scripts
- MavenITgh12571BuildReportTest: 8 ITs covering build report, console modes,
  warning mode, version info on failure, and mvnlog viewer
@gnodet
gnodet force-pushed the feature/warning-mode branch from 850a04c to 5913a2b Compare August 9, 2026 08:11
@gnodet
gnodet marked this pull request as ready for review August 9, 2026 08:11

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Well-structured mvnlog tool that follows established Maven tool patterns. Two minor polish items noted after verification (three other findings about shell script flag stripping and JSON parser depth were false positives).

Also noted:

  • The zero-dependency JSON reader/writer approach is sound — no JSON library exists in maven-cli's dependency tree.
  • The 11 existing IT modifications adding --console=verbose are necessary for the new console mode system.
  • Strong test coverage with 12 integration test cases.

This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.

Claude Code on behalf of gnodet

}
}

private List<Completer> mvnlogCompleter(String name) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The tab-completer only offers --diagnostics, --failures, --full, --list but is missing 5 of the 9 supported options: --json, --module, --mojo, --level, --grep. This reduces discoverability in mvnsh.

Suggested change
private List<Completer> mvnlogCompleter(String name) {
private List<Completer> mvnlogCompleter(String name) {
return List.of(new ArgumentCompleter(new StringsCompleter(
"--diagnostics", "--failures", "--full", "--list", "--json",
"--module", "--mojo", "--level", "--grep")));

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant