gnodet opened a new pull request, #11868: URL: https://github.com/apache/maven/pull/11868
## Summary - When a Maven 3 plugin dynamically adds a resource via `project.addResource()` or `project.getResources().add()`, propagate the change to the model's `Build.resources` so that `project.getBuild().getResources()` stays in sync with `project.getResources()` - This fixes resource ordering issues when running Maven 3 plugins (e.g. maven-source-plugin 3.x) on Maven 4 ### Root cause In Maven 3, `project.getResources()` and `project.getBuild().getResources()` return the **same** mutable list. In Maven 4's compatibility layer, they are disconnected: `getResources()` returns a virtual list backed by the internal `sources` set, while `getBuild().getResources()` returns a WrapperList backed by the model. When `maven-remote-resources-plugin` adds a resource directory, only the `sources` set was updated. The `maven-source-plugin`'s `createArchiver()` method uses `project.getBuild().getResources()` to find the `maven-shared-archive-resources` directory and add META-INF files first in the JAR — but in Maven 4 it couldn't find it, causing the META-INF entries to appear at the end instead of the beginning. See: https://github.com/apache/maven-source-plugin/pull/281 ## Test plan - [x] Existing `ResourceIncludeTest` passes (10 tests) - [x] Full `maven-core` test suite passes (545 tests) - [ ] Verify with maven-source-plugin 3.x reproducible IT on Maven 4 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
