Skip to content

[MRRESOURCES-81] Unexpected behaviour when bundled resource has the same name as another file in src/main/resources #183

@jira-importer

Description

@jira-importer

Falko Modler opened MRRESOURCES-81 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 <attachToMain>false</attachToMain> and <attachToTest>true</attachToTest>. 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 <attachToMain>false</attachToMain> - 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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority:minorMinor loss of function, or other problem where easy workaround is present

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions