Skip to content

Pipe structured BuilderProblems directly into DiagnosticCollector instead of re-logging as text #12643

Open

Description

@gnodet

Context

PR #12572 (Build Report Foundation) introduced a warning collection pipeline that intercepts SLF4J WARN-level log calls via BuildReportCollector.captureLogEvent() and auto-creates BuilderProblem objects with synthetic keys (auto:xxx).

However, Maven already creates structured BuilderProblem objects during model/settings/toolchains validation (with key, suggestion, documentationUrl, source:line:column) and plugin validation (deprecated mojos, Maven 2 dependencies, etc.). These are currently re-logged as plain text, losing all structured metadata.

Problem

When the SLF4J hook intercepts the re-logged text, it creates a new synthetic BuilderProblem with:

  • An auto-generated key (auto:logger-name:hash) instead of the original meaningful key
  • No suggestion
  • No documentationUrl
  • No source location

The original structured BuilderProblem data is discarded.

Implementation Status

✅ Done — Plugin validation (PR #12647)

PR #12647 implements structured BuilderProblem piping for all plugin validation pathways:

Pathway Component Status
1 — Model validation DefaultModelProblemCollector ✅ Verified existing
2 — Plugin parameter validation AbstractMavenPluginParametersValidator (3 validators) ✅ Implemented
3 — Plugin dependency validation AbstractMavenPluginDependenciesValidator (4 validators) ✅ Implemented
4 — Contextualizable check DefaultMavenPluginManager ✅ Implemented
5 — PluginValidationManager API Migrated from String → BuilderProblem ✅ Implemented

Additionally, PluginValidationManager was migrated to accept BuilderProblem natively, with deprecated String-based default methods for backward compatibility.

🔲 Remaining — Settings and toolchains validation

In LookupInvoker and MavenInvoker, settings/toolchains BuilderProblem objects are still re-logged as text before being captured. Same pattern as above — pipe the original BuilderProblem directly instead of only logging the message text.

Validators affected

Validator Status
DefaultModelValidator (~35 sites) ✅ Already structured (Pathway 1)
DeprecatedPluginValidator ✅ PR #12647
Maven2DependenciesValidator ✅ PR #12647
Maven3CompatDependenciesValidator ✅ PR #12647
MavenScopeDependenciesValidator ✅ PR #12647
MavenMixedDependenciesValidator ✅ PR #12647
ReadOnlyPluginParametersValidator ✅ PR #12647
DeprecatedCoreExpressionValidator ✅ PR #12647
DefaultSettingsValidator (~15 sites) 🔲 Remaining
DefaultToolchainsBuilder 🔲 Remaining
Profile activators (File, JDK) 🔲 Remaining

Expected Outcome

mvnlog --diagnostics displays full structured information:

Problems: 2 warnings

  [WARN]  'prerequisites' is deprecated   pom.xml
          key: deprecated-prerequisites
          suggestion: Use the maven-enforcer-plugin instead
          docs: https://maven.apache.org/pom.html#prerequisites

  [WARN]  Plugin uses deprecated Maven 2 API   maven-shade-plugin:3.5.0
          key: plugin-maven2-dependency
          suggestion: Update to a version that uses Maven 4 API

Depends on

Activity

  1. added
    enhancement
    on Jul 31, 2026
  2. added 19 commits that reference this issue on Jul 31, 2026
    e3cc24a
    36eb01d
    278125c
    8ceb7ca
    eb96516
    d46f47d
    0e0c4e7
    dc9e4fd
    4463770
    6288076
    8ef52fb
    a4ad516
    c5cdbba
    02f9456
    b0d3de4
    077ef5d
    dbf0ac6
    563341b
    84d77ae
  3. added this to the 4.1.0 milestone on Aug 23, 2026
  4. added 2 commits that reference this issue on Sep 18, 2026
    33f16e8
    0661b09
  5. added 3 commits that reference this issue on Oct 26, 2026
    0307520
    e2a02fa
    264f984
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementmvn4

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions