Skip to content

Filtering of overlapping <resource> entries regressed between 3.3.1 and 3.3.2 #333

Closed

Description

@rzo1

Affected versions

maven-filtering 3.3.2 and later (3.3.2, 3.4.0, 3.5.0). Last known-good: 3.3.1.

Summary

When a single source directory is covered by two <resource> entries:
one with filtering=true plus a narrow <include>, the other with
filtering=false plus <include>**</include>; the file selected by the
first entry is no longer filtered. The placeholder is left as the literal
${...} text instead of being replaced.

This was first reported downstream against maven-resources-plugin in
apache/maven-resources-plugin#471. Bisecting the
maven-resources-plugin history shows the regression entered with
493aa46, a one-line dependency bump from
maven-filtering 3.3.1 → 3.3.2, with no source change in the plugin itself.
The root cause therefore lives here, in maven-filtering.

Reproducer

A self-contained JUnit test that exercises MavenResourcesFiltering
directly is available on a branch:

https://github.com/rzo1/maven-filtering/tree/mrp-471-overlapping-resources-repro

Activity

  1. rzo1 commented on May 5, 2026

    @rzo1
    ContributorAuthor

    FYI: A bisect leads to: 1371dcf

    When two entries cover the same source directory, DefaultMavenResourcesFiltering processes them in
    declaration order. With the old copyFile(..., overwrite) API, the first (filtered) entry wrote the file with overwrite=true, then the second (unfiltered) entry wrote the raw source and would only overwrite if overwrite=true. After this commit, every write happens unconditionally through CachingOutputStream; so th second entry's raw copy clobbers the first entry's filtered output, leaving the literal ${repro.value} on disk.

    Put another way: 3.3.1's overwrite flag let the first writer "win" for files explicitly included in a filtered entry. 3.3.2 lost that distinction by collapsing the API.

  2. added
    bug
    on May 10, 2026
  3. added this to the 3.5.1 milestone on May 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions