Skip to content

Fix #11899: DefaultSettingsXmlFactory.write() always emits location comments#11929

Closed
gnodet wants to merge 1 commit intomasterfrom
ci-issue-11899
Closed

Fix #11899: DefaultSettingsXmlFactory.write() always emits location comments#11929
gnodet wants to merge 1 commit intomasterfrom
ci-issue-11899

Conversation

@gnodet
Copy link
Copy Markdown
Contributor

@gnodet gnodet commented Apr 11, 2026

Summary

  • Fix DefaultSettingsXmlFactory.write() to default addLocationInformation to false and only enable it when an explicit inputLocationFormatter is provided via XmlWriterRequest, matching the existing behavior of DefaultModelXmlFactory.write()
  • Apply the same fix to DefaultToolchainsXmlFactory.write() which had the identical bug
  • Add tests verifying that location comments are suppressed by default and only emitted when a formatter is explicitly provided

Closes #11899

Test plan

  • New DefaultSettingsXmlFactoryTest verifies no location comments without formatter
  • New DefaultSettingsXmlFactoryTest verifies location comments appear with explicit formatter
  • All 459 existing tests in maven-impl pass

Claude Code on behalf of Guillaume Nodet

…omments

DefaultSettingsXmlFactory and DefaultToolchainsXmlFactory always emitted
InputLocation comments because they created bare StaxWriter instances
whose addLocationInformation field defaults to true. This aligns both
factories with DefaultModelXmlFactory by defaulting location tracking
to false and only enabling it when an explicit inputLocationFormatter
is provided via XmlWriterRequest.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gnodet
Copy link
Copy Markdown
Contributor Author

gnodet commented Apr 12, 2026

Claude Code on behalf of Guillaume Nodet

Closing in favor of #11924 which was raised first with the same fix for DefaultSettingsXmlFactory. Will submit the additional changes (toolchains fix + tests) as a PR to that branch.

@gnodet gnodet closed this Apr 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DefaultSettingsXmlFactory.write() Always Emits Location Comments

1 participant