gnodet opened a new pull request, #409:
URL: https://github.com/apache/maven-filtering/pull/409

   ## Problem
   
   When a user configures a custom delimiter (e.g. `@@`) and disables the 
default `${*}` delimiter (`useDefaultDelimiters=false`), compound POM 
properties whose values reference other properties via Maven's native `${key}` 
syntax were not fully resolved.
   
   **Scenario:**
   - Plugin (e.g. `buildnumber-maven-plugin`) injects property `buildNumber=42` 
at runtime
   - POM declares `<version>1.0-${buildNumber}</version>` in `<properties>`
   - Resource file contains `@version@` with only `@@` as the configured 
delimiter
   - Expected output: `1.0-42`
   - Actual output: `1.0-${buildNumber}` (literal, unresolved)
   
   With default delimiters active the `${}` pass resolved the nested reference; 
with custom-only delimiters it could not.
   
   ## Root Cause
   
   Properties are stored **raw** in `filterProperties` — POM/plugin properties 
are never pre-interpolated. The resource-file interpolator only processes the 
user-configured delimiter, so `${runtimeProp}` inside the resolved value of a 
compound property is left untouched.
   
   External **filter files** already get this treatment via 
`PropertyUtils.loadPropertyFile()`, which resolves all `${}` references against 
`baseProps`. POM properties and runtime-injected plugin properties did not 
benefit from the same treatment.
   
   ## Fix
   
   Replace `PropertiesBasedValueSource` with a new 
`RecursivePropertiesValueSource` inner class that, on each `getValue()` call, 
resolves any `${...}` references within the returned value using the full 
`filterProperties` set — exactly the strategy already applied to external 
filter files by `PropertyUtils`.
   
   `PropertyUtils.getPropertyValue()` is widened from `private` to 
package-private so the new class can reuse it without duplication. Cycle 
detection (already present in `PropertyUtils.getPropertyValue`) prevents 
infinite loops for self-referential properties.
   
   ## Tests
   
   Five new unit tests in `CompoundPropertyResolutionTest`:
   - Baseline with default delimiters (regression guard)
   - Custom delimiter only — the bug scenario
   - Three-level transitive chain (`A → B → C`)
   - Circular reference guard (must not loop)
   - Both custom and default delimiters active simultaneously
   
   All 105 tests pass (`mvn verify`).
   
   Fixes: https://github.com/apache/maven-resources-plugin/issues/328 
(MRESOURCES-254)


-- 
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]

Reply via email to