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

   ## Summary
   
   Fixes the 4 failing integration tests reported in #442 that occur when 
building with Maven 4.0.0-rc-5.
   
   ## Root Cause
   
   Maven 4.0.0-rc-5 introduced a bug in `EnhancedCompositeBeanHelper` 
([apache/maven#11425](https://github.com/apache/maven/pull/11425)) where field 
accessibility state was cached globally using `ConcurrentMap<Field, Boolean>`. 
This cache caused plugin configuration injection to fail when:
   
   - The `buildFilters` field (injected via `${project.build.filters}`) was not 
properly populated for `TestResourcesMojo` when both `resources` and 
`testResources` goals ran in the same build
   - The `skip` field in `TestResourcesMojo` shadowed the parent 
`ResourcesMojo.skip` field (same name, both `private`), confusing the field 
accessibility cache
   
   ## Failing Tests
   
   - **`escapeInterpolation`**, **`filter-test-resources`**, 
**`MRESOURCES-77`**: `SomeResource.txt not contains test:filter resolution 
project.version=1.0-SNAPSHOT` — build filters from `\<build\>\<filters\>` were 
not applied to test resources because `buildFilters` field injection failed for 
`TestResourcesMojo`
   - **`MRESOURCES-131`**: `assert !skippedFile.exists()` failed — the 
`\<skip\>true\</skip\>` plugin config didn't skip `testResources` because 
`TestResourcesMojo.skip` was not properly injected due to the field shadowing 
with `ResourcesMojo.skip`
   
   ## Changes
   
   ### 1. `TestResourcesMojo`: Remove the shadowing `skip` field
   
   The `private boolean skip` field in `TestResourcesMojo` (bound to 
`maven.test.skip`) shadowed the parent's `private boolean skip` field (bound to 
`maven.resources.skip`). Both having the same field name in the class hierarchy 
triggered the rc-5 caching bug.
   
   **Fix**: Remove the `@Parameter`-injected `skip` field and replace with 
`isTestSkip()` which:
   - Delegates to the parent's `isSkip()` (handles `\<skip\>true\</skip\>` in 
plugin config)
   - Reads `maven.test.skip` directly from session properties (handles 
`-Dmaven.test.skip=true`)
   
   ### 2. `ResourcesMojo`: Fallback for `buildFilters` field
   
   Add a fallback in `getCombinedFiltersList()` to read build filters directly 
from `project.getBuild().getFilters()` when the `buildFilters` field is null 
(not injected). This makes filter loading robust against injection failures.
   
   ### 3. Upgrade `mavenVersion` to `4.0.0-rc-5`
   
   Update the compile target from `4.0.0-rc-4` to `4.0.0-rc-5` so CI tests 
against the same Maven version that exposed these issues.
   
   ## Notes
   
   The underlying Maven bug is fixed in 4.0.0-rc-6 
([apache/maven#11433](https://github.com/apache/maven/pull/11433)). These 
plugin-side changes also fix the behavior with rc-5 and make the plugin more 
robust in general.


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