apache / apache/maven-remote-resources-plugin
[MRRESOURCES-81] Unexpected behaviour when bundled resource has the same name as another file in src/main/resources
- Dominant language
- Java
- Stars
- 17
- Forks
- 18
- Avg merge
- 6h 5m
- Merged PRs (30d)
- 5
Description
**[Falko Modler](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=famod)** opened **[MRRESOURCES-81](https://issues.apache.org/jira/browse/MRRESOURCES-81?redirect=false)** and commented
Scenario:
Some project bundles a file named `META-INF/beans.xml`.
Another project wants to use that file for its tests, so it sets `false` and `true`. Now let's assume that this project also has a file named `META-INF/beans.xml` under `src/main/resources`.
My assumption - especially when using `false` - is that everything should be fine: the beans.xml from the bundle should not be conflicting with the one from the main branch of the project that wants to use the bundled file.
But this is what happens instead: The file from `src/main/resources` ends up in `maven-shared-archive-resources`, **not** the one from the bundle.
The problem is caused by the way existing project resources are seemingly preferred over the bundled resources from the user defined artifact (and are even copied to the output directory). From a user perspective, this is not what I want. See also `ProcessRemoteResourcesMojo.copyResourceIfExists(...)`.
A possible fix might be to introduce a new property like `preferProjectResources` which can be set to `false` (which should be the default value in my opinion, would break backwards compatibility though).
---
**Affects:** 1.5
**Attachments:**
- [MRRESOURCES-81.zip](https://issues.apache.org/jira/secure/attachment/12718323/MRRESOURCES-81.zip) (_7.95 kB_)
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the META-INF/beans.xml scenario from the issue or the attached MRRESOURCES-81.zip, then inspect ProcessRemoteResourcesMojo.copyResourceIfExists(...) and the attachToMain/attachToTest handling. Determine the intended precedence when attachToMain is false; done means the bundled resource is selected without the project resource being copied over it, with regression coverage for the reported setup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100