mvnlog: build log viewer, integration tests, script routing - #12699
mvnlog: build log viewer, integration tests, script routing#12699gnodet wants to merge 1 commit into
Conversation
0cc76eb to
6124231
Compare
dc3bccd to
a7c83db
Compare
a7c83db to
7243fd7
Compare
7243fd7 to
af945c2
Compare
af945c2 to
850a04c
Compare
9924a43 to
4d7e49f
Compare
- 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
850a04c to
5913a2b
Compare
gnodet
left a comment
There was a problem hiding this comment.
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=verboseare 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) { |
There was a problem hiding this comment.
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.
| 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"))); |
gnodet
left a comment
There was a problem hiding this comment.
Well-structured addition of the mvnlog viewer tool that follows established Maven tool patterns. Two minor polish items:
Confirmed findings (verified independently):
-
[Medium — Dead code]
BuildReportRenderer.java:51— Unused constantMAX_PADDED_BUILD_TIME_DURATION_LENGTHis declared but never referenced anywhere in the class. TheformatDurationmethod does not use it. Appears to be a leftover copy fromExecutionEventLoggerwhere it is actively used. -
[Low — Incomplete shell completer]
BuiltinShellCommandRegistryFactory.java:268— ThemvnlogCompleteronly includes--diagnostics,--failures,--full,--listbut is missing the 5 filter/output options defined inCommonsCliLogOptions.CLIManager:--json,--module,--mojo,--level,--grep. Users inmvnshwill not get tab completion for these valid options.
This review was generated by an AI agent (Claude Code) and may contain inaccuracies. Please verify all suggestions before applying.
Claude Code on behalf of Guillaume Nodet
| private final Consumer<String> output; | ||
|
|
||
| public BuildReportRenderer(MessageBuilderFactory messageBuilderFactory, Consumer<String> output) { | ||
| this.messageBuilderFactory = messageBuilderFactory; |
There was a problem hiding this comment.
[Medium — Dead code] This constant is declared but never referenced anywhere in this class. It's actively used in ExecutionEventLogger (lines 61 and 272), but appears to be a copy-paste leftover here.
| ParserRequest.mvnlog(input.args(), shellContext.invokerRequest.messageBuilderFactory()) | ||
| .cwd(shellContext.cwd.get()) | ||
| .build())); | ||
| } catch (InvokerException.ExitException e) { |
There was a problem hiding this comment.
[Low — Incomplete completer] This completer only includes 4 of the 9 options defined in CommonsCliLogOptions.CLIManager. Missing: --json, --module, --mojo, --level, --grep.
Users in mvnsh won't get tab completion for the filter features.
Summary
Part 5 of the logging feature chain. Depends on #12698 (warning mode).
Adds the
mvnlogtool — 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 JSONBuildReportRenderer— renders reports with ANSI colors, timing, failure detailsSimpleJsonReader— dependency-free streaming JSON parserLogInvoker/LogParser/LogContext— invoker chain for the toolCommonsCliLogOptions/LogOptions— CLI option parsingMavenLogCling— entry point classScript routing
mvn --logroutes toMavenLogCling(bothmvnandmvn.cmd)--logfrom colliding with--log-fileprefix matchingmvnlog/mvnlog.cmdshell scripts for direct invocationcomponent.xmlupdated to includemvnlogin the distributionIntegration tests
MavenITgh12571BuildReportTest— 8 IT tests covering build report JSON, console modes (plain/machine/verbose), warning mode, version info on failure, and mvnlog viewer--console=verboseto preserve expected output formatFiles changed (36 files, ~2500 insertions)
Tools.java,LogOptions,ParserRequestMavenLogClingLogInvoker,LogParser,LogContext,CommonsCliLogOptionsBuildReportRenderer,SimpleJsonReaderBuiltinShellCommandRegistryFactory(mvnlog command)mvn,mvn.cmd,mvnlog,mvnlog.cmd,component.xmlCommonsCliOptions(+--logconstant/option)BuildReportRendererTest,SimpleJsonReaderTestMavenITgh12571BuildReportTest+ 11 existing ITs + 4 resource POMsPR chain
mvnlogviewerTest plan
mvn compile— clean compilemvn test -pl impl/maven-cli— all tests pass🤖 Generated with Claude Code