gnodet opened a new pull request, #1101: URL: https://github.com/apache/maven-compiler-plugin/pull/1101
## Summary Maps `javax.tools.Diagnostic` to `BuilderProblem` and reports via the new `DiagnosticReporter` service from Maven 4.1.0, so compiler warnings and errors appear with structured keys, source locations, and severity in the build report and `mvnlog --diagnostics` output. Related: [apache/maven#12644](https://github.com/apache/maven/issues/12644) — follow-up to [apache/maven#12572](https://github.com/apache/maven/pull/12572) (Build Report Foundation). ### Changes - **`AbstractCompilerMojo`**: Add `@Inject DiagnosticReporter diagnosticReporter` - **`DiagnosticLogger`**: Accept `DiagnosticReporter` in constructor; for each `javax.tools.Diagnostic`, create a `BuilderProblem` with: - `key("compiler:" + diagnostic.getCode())` — e.g. `compiler:compiler.warn.unchecked` - `severity` mapped from `Diagnostic.Kind` (ERROR→ERROR, WARNING→WARNING, etc.) - `source`, `lineNumber`, `columnNumber` from the diagnostic - **`ToolExecutor`**: Pass `diagnosticReporter` through to `DiagnosticLogger` - **`pom.xml`**: Bump `mavenVersion` to `4.1.0-SNAPSHOT` for `DiagnosticReporter` API ### Design decisions - **Per-type dedup key**: Each diagnostic uses `"compiler:<code>"` as the key, so 50 unchecked warnings produce a single summary entry with count=50. Individual per-file details remain in the build log. - **Suppression**: Users can suppress compiler diagnostics via `-Dmaven.diagnostic.suppress=compiler:*` (all) or `compiler:compiler.warn.unchecked` (specific). - **No behavior change**: Existing logging behavior is unchanged — `DiagnosticReporter` is additive. ### Test changes - Updated test imports for `maven-testing` package relocation (4.0.0-rc-4 → 4.1.0-SNAPSHOT) - Added no-op `DiagnosticReporter` provider in test DI configuration ## Test plan - [x] `mvn test` — 16 tests pass, 0 failures - [x] `mvn compile` — 0 checkstyle violations, spotless clean - [ ] CI — awaiting results ## Dependencies This PR requires Maven core 4.1.0-SNAPSHOT which includes: - `DiagnosticReporter` service ([apache/maven#12572](https://github.com/apache/maven/pull/12572)) - `BuilderProblem.builder()` with `key()`, `suggestion()`, `documentationUrl()` fields -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
