gnodet opened a new pull request, #13626:
URL: https://github.com/apache/maven/pull/13626
Backport of #13607 to `maven-4.0.x`.
Conflict resolution: adapted the raw-XML interpolation approach from master
to use
`settingsXmlFactory.read(XmlReaderRequest...)` (the 4.0.x API) instead of the
`SettingsParser.parse()` API introduced in 4.1.0. The
`DefaultSettingsParserTest`
class does not exist on 4.0.x and was removed.
---
Port of the settings interpolation fix from 3.10.x (commit 24deab9b74, fixes
#11011).
## Problem
Settings interpolation only worked for String fields. Non-String fields such
as
`proxy.port` (int) and `proxy.active` (boolean) containing `${...}` property
placeholders would fail to parse or silently use default values.
Additionally,
settings XML parsing errors were always downgraded to `WARNING`, making it
hard
to detect malformed settings files.
## Fix
1. **Raw XML interpolation before parsing**: wraps the settings source to
interpolate
property placeholders at the raw-XML text level before Modello converts
field values
to their target types (int, boolean, etc.)
2. **XML-escape resolved values**: property values containing XML special
characters
are safely escaped before substitution to prevent malformed XML
3. **Strict parsing mode**: when `maven.settings.strictParsing=true`, XML
parse errors
are reported at `FATAL` severity and parsing stops immediately
## Changes
- `Constants.java`: added `MAVEN_SETTINGS_STRICT_PARSING` constant
- `DefaultSettingsBuilder.java`: added `interpolateSource()` and
`xmlEscape()`
helper methods; adapted `readSettings()` to use interpolated source and
strict mode
- Tests: proxy interpolation test with `${test.proxy.port}` and
`${test.proxy.active}`
- Test resources: `settings-proxy-interpolation.xml`,
`settings-unknown-element.xml`,
`settings-xml-markup-interpolation.xml`
--
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]