[MNG-8765] Pre-interpolate plugin configuration before type conversion (4.0.x backport) - #13019
Merged
Conversation
Fix the property interpolation ordering issue for URI-typed plugin
parameters. The ComponentConfigurator converts raw strings to
java.net.URI BEFORE resolving ${...} properties, causing
URISyntaxException because curly braces are illegal URI characters.
The fix pre-interpolates the configuration tree by rebuilding the
immutable XmlNode hierarchy bottom-up with resolved values before
passing it to the ComponentConfigurator. This is necessary because
XmlNode is @immutable — mutating transient PlexusConfiguration
wrappers does not propagate changes back to the underlying tree.
Only expressions referencing properties that were NOT available during
model interpolation are resolved. Properties from the POM's
<properties>, user properties (-D), and system properties are skipped
because model interpolation already had a chance to resolve them — any
surviving ${...} for those properties was intentionally escaped
(MNG-3558).
Key changes:
- Add interpolateXmlNode() that rebuilds the XmlNode tree with
resolved expression values, preserving immutability semantics
- Only interpolate runtime-set properties (not model-time ones),
respecting property escaping (MNG-3558)
- Apply pre-interpolation to both loadV3Mojo and loadV4Mojo paths
- Add XmlPlexusConfiguration.toXmlNode() accessor
- Add SetPropertyMojo to IT plugin for runtime property testing
- Add integration test covering the actual MNG-8765 scenario:
properties set dynamically at runtime via
project.getProperties().setProperty() (not available during
model interpolation)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Adapt MavenITmng8765UriPropertyInterpolationTest to the 4.0.x AbstractMavenIntegrationTestCase API: use File instead of Path, String constructor instead of no-arg, and leading slash in resource paths. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of beee0f0 from master to
maven-4.0.x.Pre-interpolates the plugin configuration tree before the ComponentConfigurator processes it, so that
${...}property references set dynamically at runtime are resolved before type converters (like UriConverter) attempt to parse the values.Second commit adapts the IT to the 4.0.x
AbstractMavenIntegrationTestCaseAPI (File vs Path, String constructor).