abhu85 opened a new pull request, #11984: URL: https://github.com/apache/maven/pull/11984
## Summary - Default `addLocationInformation` to `false` in `DefaultSettingsXmlFactory.write()` and `DefaultToolchainsXmlFactory.write()` - Respect `inputLocationFormatter` from `XmlWriterRequest` — only emit location comments when explicitly requested - Align behavior with `DefaultModelXmlFactory.write()`, which already handles this correctly ## Problem `DefaultSettingsXmlFactory.write()` always emits `InputLocation` comments (e.g. `<!-- /path/to/settings.xml:163 -->`) because it creates a bare `new SettingsStaxWriter()` whose `addLocationInformation` field defaults to `true`. It also ignores the `inputLocationFormatter` from the `XmlWriterRequest`. This is inconsistent with `DefaultModelXmlFactory.write()`, which correctly defaults location tracking to `false` and only enables it when an explicit `inputLocationFormatter` is provided. The same issue exists in `DefaultToolchainsXmlFactory.write()`. ## Solution Applied the same pattern from `DefaultModelXmlFactory.write()` (lines 165-174) to both: 1. Create the StaxWriter instance 2. Set `addLocationInformation(false)` by default 3. Check `request.getInputLocationFormatter()` — if provided, enable location information and set the string formatter ## Test Plan - [x] `mvn -pl impl/maven-impl -am test` — 461 tests pass, 0 failures - [x] `mvn spotless:apply` — formatting applied - [x] `git diff --check` — no whitespace issues ## Compatibility - No breaking changes — callers that don't provide `inputLocationFormatter` now get cleaner XML - Callers that explicitly provide `inputLocationFormatter` will continue to get location comments Fixes #11899 -- 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]
