ascheman opened a new pull request, #480:
URL: https://github.com/apache/maven-resources-plugin/pull/480

   ## Summary
   
   The `user-filters` integration test is the single IT failing under Maven 
4.0.0-rc-5 on the 3.x maintenance line, which leaves PR #466 ("enable build 
with Maven 4") in an UNSTABLE state. This PR fixes the IT fixture so the rc-5 
matrix turns green.
   
   ## Root cause
   
   The IT exercises a user-supplied `MavenResourcesFiltering` (`ItFilter`) and 
passes `toto=titi` via `invoker.userPropertiesFile = test.properties`, which 
`maven-invoker-plugin` forwards as `-Dtoto=titi` to the forked Maven.
   
   - On Maven 3, CLI `-D` values land in both 
`MavenSession.getUserProperties()` and the view returned by 
`getSystemProperties()`.
   - On Maven 4 (rc-5 and current `apache/maven` master), 
`getSystemProperties()` is strict and returns only actual JVM system 
properties; CLI `-D` lives exclusively in `getUserProperties()`.
   
   `ItFilter.filterResources` only read `getSystemProperties()`, so under Maven 
4 the generated `foo.txt` contained `toto=null` and the post-build groovy 
assertion `assert content.contains('toto=titi')` failed.
   
   The bug is entirely in the IT fixture; the production `MavenResourcesPlugin` 
is unaffected (it routes through `maven-filtering`, which already consults both 
buckets).
   
   ## Fix
   
   Consult `getUserProperties()` first in `ItFilter`, falling back to 
`getSystemProperties()`. Compiles and runs on Maven 3.9.x and Maven 4.0.0-rc-5+.
   
   ## Verification
   
   - `mvn -Prun-its verify` against Maven 4.0.0-rc-5 (macOS aarch64, JDK 17): 
**27/27 ITs pass** (was 26/27).
   - `target/it/user-filters/target/classes/foo.txt` now contains `toto=titi`.
   
   ## Context
   
   - Unblocks #466 (CI matrix flip to `maven4-enabled: true`).
   - Part of the broader "[REVIEW REQUEST] Maven 4 compatibility test fixes - 
17 PRs targeting 4.0.0-rc-6" effort on `dev@maven` (2026-06-05).
   - No production code change; no POM/dependency bump.
   - Checked `master` (4.x rewrite, `4.0.0-beta-2-SNAPSHOT`): equivalent file 
already consults `getUserProperties()` — no follow-up needed there.
   


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