GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Structured BuilderProblem pipeline for DiagnosticCollector by gnodet · Pull Request #12702 · apache/maven

Conversation

@gnodet

@gnodet gnodet commented Aug 8, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Why

After #12698 introduced BuilderProblem enrichments (key, suggestion, docs URL) and DiagnosticCollector, plugin validation warnings were still flowing through the old string-based PluginValidationManager API — losing all structured metadata before reaching the collector. Additionally, several Maven core subsystems (graph builder, project selector, settings/toolchains parsing) were logging ModelProblem instances as plain text, discarding source location, severity, and the ability to deduplicate them in the build report.

What

1. PluginValidationManager interface migration

The three abstract methods now accept BuilderProblem instead of String:

void reportPluginValidationIssue(IssueLocality, RepositorySystemSession, Artifact, BuilderProblem);
void reportPluginValidationIssue(IssueLocality, MavenSession, MojoDescriptor, BuilderProblem);
void reportPluginMojoValidationIssue(IssueLocality, MavenSession, MojoDescriptor, Class<?>, BuilderProblem);

The old String-based signatures are retained as @Deprecated(since = "4.1.0", forRemoval = true) default methods for backward compatibility with external callers.

2. All 9 internal call sites updated across 8 files: DeprecatedPluginValidator, DeprecatedCoreExpressionValidator, ReadOnlyPluginParametersValidator, Maven2DependenciesValidator, Maven3CompatDependenciesValidator, MavenMixedDependenciesValidator, MavenScopeDependenciesValidator, PlexusContainerDefaultDependenciesValidator, and DefaultMavenPluginManager (Contextualizable check). Each site now constructs a BuilderProblem with a stable key and, where applicable, an actionable suggestion.

3. Structured ModelProblem piping in DefaultMaven, DefaultProjectsSelector, LookupInvoker (settings), and MavenInvoker (toolchains): problems are converted to BuilderProblem via a toBuilderProblem() helper and piped directly to DefaultDiagnosticCollector, preserving source file, line, column, and severity. These loggers are added to BuildReportCollector.EXCLUDED_LOGGERS to prevent double-counting from the SLF4J WARN auto-collection hook.

4. DefaultPluginValidationManager is wired with DefaultDiagnosticCollector via constructor injection and pipes every incoming BuilderProblem directly to it (in addition to the existing internal issue tracking).

5. DefaultBuilderProblem internal class removed from call sites in tests — replaced by BuilderProblem.builder() as the canonical construction path.

6. DefaultMaven.doExecute — minor cleanup: the try { try { } } finally nesting around session scope entry is flattened; no behavior change.

7. DefaultMavenPluginManager — reverts an earlier workaround (interpolateConfiguration) that pre-interpolated ${...} expressions before the ComponentConfigurator. Also reverts redundant realm disposal guard added for a race condition that the current code no longer hits.

How

AbstractMavenPluginParametersValidator gains an abstract getValidationKeyPrefix() method and a buildParameterProblem(Parameter) helper that all three parameter validators implement. This avoids duplicating the BuilderProblem.builder() call at each site while keeping the key namespace per-validator ("deprecated-param", "readonly-param", "deprecated-expr").

PluginValidationManager binary-compatibility exclusion is added to maven-enforcer configuration so the API checker does not flag the method signature change.

PR chain

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
This was referenced Aug 8, 2026
Logging foundation: structured LogEvent, JUL handler, Log API enhancements #12694
Closed
Build report: structured JSON report with per-mojo log capture #12695
Closed
Console modes: --console=plain/rich/verbose/machine #12697
Closed
Warning mode, diagnostic collector, BuilderProblem enrichments #12698
Closed
mvnlog: build log viewer, integration tests, script routing #12699
Closed
@gnodet
gnodet force-pushed the feature/warning-mode branch from 6124231 to dc3bccd Compare August 8, 2026 05:35
@gnodet
gnodet force-pushed the feature/12643-structured-problems branch from 0e0c4e7 to 4463770 Compare August 8, 2026 05:35
@gnodet
gnodet force-pushed the feature/warning-mode branch from dc3bccd to a7c83db Compare August 8, 2026 12:14
@gnodet
gnodet force-pushed the feature/12643-structured-problems branch from 4463770 to 8ef52fb 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/12643-structured-problems branch from 8ef52fb to c5cdbba 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/12643-structured-problems branch from c5cdbba to b0d3de4 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/12643-structured-problems branch 2 times, most recently from dbf0ac6 to 84d77ae Compare August 8, 2026 21:57
@gnodet gnodet mentioned this pull request Aug 9, 2026
Migrate internal plumbing DEBUG statements to TRACE level #12714
Draft
3 of 4 tasks
@gnodet
gnodet force-pushed the feature/12643-structured-problems branch from 84d77ae to b6a409b Compare August 9, 2026 08:11
@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 commented Aug 9, 2026
View reviewed changes

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Well-structured PR that cleanly pipes structured BuilderProblems into the DiagnosticCollector. Two observations after verification (a finding about source-incompatible API changes was a false positive — old String-based methods are preserved as deprecated defaults).

Also noted:

  • The mvnlog tool addition is complete with comprehensive unit and integration tests.
  • The EXCLUDED_LOGGERS set correctly prevents double-counting for classes that now pipe BuilderProblems directly.
  • The shell script changes correctly handle --log routing.

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

Claude Code on behalf of gnodet

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread impl/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
*/
private static BuilderProblem toBuilderProblem(ModelProblem problem) {
BuilderProblem.Severity severity =
switch (problem.getSeverity()) {

@gnodet gnodet Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

The diagnostic key is generated as "model:" + problem.getMessage().hashCode(). Using String.hashCode() for deduplication keys is fragile — hash collisions would cause unrelated problems to be silently deduplicated. The same pattern appears in DefaultProjectsSelector and the deprecated adapters in PluginValidationManager.

Elsewhere in this PR, human-readable keys are used (e.g. "plugin-validation:contextualizable", "plugin-validation:maven2-plugin"). Consider using a more collision-resistant approach here too — e.g., incorporating the problem source and a truncated/normalized message.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread impl/maven-core/src/main/java/org/apache/maven/project/collector/DefaultProjectsSelector.java
@@ -100,4 +112,26 @@ public List<MavenProject> selectProjects(List<File> files, MavenExecutionRequest

@gnodet gnodet Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This toBuilderProblem(ModelProblem) method is an exact duplicate of the one in DefaultMaven.java. If the conversion logic changes, both copies must be updated in lockstep. Consider extracting to a shared utility method.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
gnodet
gnodet commented Aug 16, 2026
View reviewed changes

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Well-structured PR that correctly implements the structured BuilderProblem pipeline. The API migration preserves backward compatibility via deprecated default methods. A few items to address:

Confirmed findings (verified independently):

  1. [Medium — Windows parity gap] mvn.cmd:278 — Windows batch script sets MAVEN_MAIN_CLASS for --log but does not strip the routing flag from %* before passing it to the Java process. The Unix mvn script (lines 316-327) explicitly strips --debug, --yjp, --enc, --shell, --up, and --log to prevent Commons CLI prefix-matching collision (e.g. --log matching --log-file). On Windows, running mvn --log validate will pass --log through to the Java process, causing the documented collision.

  2. [Low — Code duplication] DefaultMaven.java:673 — The static method toBuilderProblem(ModelProblem) is duplicated character-for-character in DefaultMaven.java and DefaultProjectsSelector.java. Consider extracting to a shared utility class.

  3. [Low — Fragile dedup key] DefaultMaven.java:691 — Using message.hashCode() as part of the dedup key ("model:" + problem.getMessage().hashCode()) is fragile since String.hashCode() is a 32-bit hash that can produce collisions. Two different model problems with the same hashCode would be silently deduplicated. Using the full message or a stronger hash would be more robust.

  4. [Low — Dead code] BuildReportRenderer.java:45 — MAX_PADDED_BUILD_TIME_DURATION_LENGTH is declared but never referenced. Leftover copy from ExecutionEventLogger.

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread apache-maven/src/assembly/maven/bin/mvn.cmd
set "MAVEN_MAIN_CLASS=org.apache.maven.cling.MavenShellCling"
) else if "%~1"=="--up" (
set "MAVEN_MAIN_CLASS=org.apache.maven.cling.MavenUpCling"
) else if "%~1"=="--log" (

@gnodet gnodet Aug 16, 2026

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

[Medium — Windows parity gap] The Unix mvn script strips routing flags (--debug, --yjp, --enc, --shell, --up, --log) from $@ before exec (lines 316-327), but the Windows .cmd passes %* unmodified. Running mvn --log validate on Windows will pass --log through to Commons CLI, where it can collide with --log-file via prefix matching.

Windows batch's %* cannot be modified by shift, so equivalent stripping logic would need a for loop to rebuild the argument list.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread impl/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
.exception(problem.getException())
.message(problem.getMessage())
.severity(severity)
.key("model:" + problem.getMessage().hashCode())

@gnodet gnodet Aug 16, 2026

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

[Low — Fragile dedup key] String.hashCode() is a 32-bit hash that can produce collisions (e.g., "Aa" and "BB" both hash to 2112). If two different model problems collide, one gets silently deduplicated. Consider using the full message string or a stronger hash for the key.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
gnodet added a commit to gnodet/maven that referenced this pull request Aug 16, 2026
@gnodet
Update STATE.md — run 8: reviewed apache#12698, apache#12699, apache#…
333137c
…12702
@gnodet gnodet added this to the 4.1.0 milestone Aug 23, 2026
gnodet
gnodet commented Aug 24, 2026
View reviewed changes

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Well-structured PR that cleanly implements the structured BuilderProblem pipeline and migrates PluginValidationManager. Backward compatibility is preserved via deprecated default methods. A few design items to consider:

Windows script parity gap (mvn.cmd): The Unix script strips routing flags (--debug, --yjp, --enc, --shell, --up, --log) before passing to the JVM, but the Windows batch script does not. While the stripping was not present before for any flag on Windows, this PR widens the gap by adding a new routing flag (--log) only on Unix.

PluginValidationManager interface break: The 3 abstract methods changed from String to BuilderProblem. External implementors (not extending DefaultPluginValidationManager) will get compilation errors. This is intentional for 4.1.0 and correctly excluded from japicmp — worth noting in the PR description for downstream consumers.

Code duplication: toBuilderProblem(ModelProblem) is duplicated character-for-character in DefaultMaven.java and DefaultProjectsSelector.java. Consider extracting to a shared utility.

hashCode-based dedup keys: The pattern "model:" + problem.getMessage().hashCode() appears in 5 places across 3 files. String.hashCode() is 32-bit with known collision rates — different messages could be silently deduplicated. Low practical risk given typical Maven build volumes, but worth considering a stronger key (full message or source+line+severity).

Overall the architecture is sound — structured BuilderProblems flow cleanly through the pipeline, and the EXCLUDED_LOGGERS set correctly prevents double-counting.


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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@gnodet
gnodet force-pushed the feature/12643-structured-problems branch from b6a409b to 4b6969b Compare August 28, 2026 09:28
@gnodet
gnodet force-pushed the feature/warning-mode branch from 5913a2b to 2a54465 Compare August 28, 2026 09:28
gnodet
gnodet commented Aug 28, 2026
View reviewed changes

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Well-structured PR that introduces two major features: a mvnlog build log viewer and a structured BuilderProblem pipeline with PluginValidationManager API migration. The overall architecture is clean — the dual-path approach (structured problems piped directly + EXCLUDED_LOGGERS to prevent double-counting) is sound, and the BuilderProblem.builder() API is a nice improvement over the previous 9-parameter constructor.

Three items worth addressing before merge to master:

1. Duplicated toBuilderProblem(ModelProblem) method

DefaultMaven.java and DefaultProjectsSelector.java both contain an identical private static toBuilderProblem(ModelProblem) method with the same severity mapping, field assignment, and key generation. Both are in the impl/maven-core module, so extracting to a shared utility (e.g. a static method on a ModelProblemUtils or BuilderProblemUtils class) would prevent divergence over time.

2. Javadoc / implementation mismatch in LogOptions

The Javadoc for module() and mojo() in LogOptions.java references "glob pattern" matching, but BuildReportFilter only performs case-insensitive substring contains() matching — no glob support. Either the Javadoc should remove the "glob pattern" wording, or glob matching should be implemented.

3. Inconsistent EXCLUDED_LOGGERS constant style

In BuildReportCollector.java, three of the four EXCLUDED_LOGGERS entries use hardcoded class name strings while the first uses .class.getName(). All four classes are in the same module (impl/maven-core), so using .class.getName() consistently would provide compile-time safety against silent breakage on class rename.

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

Claude Code on behalf of Guillaume Nodet

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@gnodet
gnodet force-pushed the feature/warning-mode branch from 2a54465 to 94ee4ef Compare August 28, 2026 09:55
@gnodet
gnodet force-pushed the feature/12643-structured-problems branch from 4b6969b to 3b439d0 Compare August 28, 2026 09:55
@gnodet
gnodet force-pushed the feature/warning-mode branch from 94ee4ef to 32ce980 Compare August 28, 2026 10:16
@gnodet
gnodet force-pushed the feature/12643-structured-problems branch from 3b439d0 to 5f53884 Compare August 28, 2026 10:16
@gnodet
gnodet changed the base branch from feature/warning-mode to feature/mvnlog August 28, 2026 10:17
@gnodet
gnodet force-pushed the feature/12643-structured-problems branch from 5f53884 to a964976 Compare August 31, 2026 08:55
@gnodet
gnodet force-pushed the feature/mvnlog branch from 11b4c52 to 69b8969 Compare August 31, 2026 08:55
@gnodet
gnodet force-pushed the feature/mvnlog branch from 69b8969 to 79397b6 Compare September 18, 2026 11:10
@gnodet
gnodet force-pushed the feature/12643-structured-problems branch from a964976 to 33f16e8 Compare September 18, 2026 11:11
@gnodet
Fix #12643: Structured BuilderProblem pipeline and PluginValidationMa…
0661b09
…nager migration
@gnodet
gnodet force-pushed the feature/mvnlog branch from 79397b6 to bde251c Compare September 18, 2026 11:21
@gnodet
gnodet force-pushed the feature/12643-structured-problems branch from 33f16e8 to 0661b09 Compare September 18, 2026 11:21
@gnodet gnodet mentioned this pull request Sep 18, 2026
Console modes: --console=plain/rich/verbose/machine #13180
Draft
@gnodet gnodet added enhancement New feature or request mvn4 labels Oct 14, 2026
@gnodet-bot gnodet-bot mentioned this pull request Oct 14, 2026
[#8485] Remember if Maven model problems were encountered in Maven 4 #12620
Open
7 of 8 tasks
This was referenced Oct 15, 2026
feat: add BuildInvocation API to Session #13542
Merged
Build output overhaul: structured build report, diagnostic collector, console modes #12571
Open
@gnodet gnodet mentioned this pull request Oct 26, 2026
feat: structured BuilderProblem pipeline for DiagnosticCollector gnodet/maven#127
Open
1 task
@gnodet gnodet closed this Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

enhancement New feature or request mvn4

Projects

None yet

Milestone

4.2.0

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@gnodet
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.