Skip to content

[MNG-8765] Pre-interpolate plugin configuration before type conversion (4.0.x backport) - #13019

Merged
gnodet merged 2 commits into
maven-4.0.xfrom
backport/MNG-8765-to-4.0.x
Sep 2, 2026
Merged

[MNG-8765] Pre-interpolate plugin configuration before type conversion (4.0.x backport)#13019
gnodet merged 2 commits into
maven-4.0.xfrom
backport/MNG-8765-to-4.0.x

Conversation

@gnodet

@gnodet gnodet commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

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 AbstractMavenIntegrationTestCase API (File vs Path, String constructor).

gnodet and others added 2 commits September 2, 2026 14:03
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>
@gnodet gnodet added the bug Something isn't working label Sep 2, 2026
@gnodet gnodet self-assigned this Sep 2, 2026
@gnodet gnodet added this to the 4.0.0-rc-7 milestone Sep 2, 2026
@gnodet
gnodet merged commit 64bc229 into maven-4.0.x Sep 2, 2026
51 checks passed
@gnodet
gnodet deleted the backport/MNG-8765-to-4.0.x branch September 2, 2026 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant