Skip to content

Filtering changed behaviour from 3.3.1Β #471

Closed

Description

@peter-c-larsson

Affected version

3.4.0 and 3.5.0

Bug description

The following code works for us in 3.3.1 when use filter on a single file in our setup. When upgrading to 3.4.0 and 3.5.0 the following code has stopped working and no filtering is taking place in our file db/changelog/db.changelog-client-secret.xml

        <resources>
            <resource>
                <filtering>true</filtering>
                <directory>src/main/resources</directory>
                <includes>
                    <include>db/changelog/db.changelog-client-secret.xml</include>
                </includes>
            </resource>
            <resource>
                <filtering>false</filtering>
                <directory>src/main/resources</directory>
                <includes>
                    <include>**</include>
                </includes>
            </resource>
        </resources>

The file that is being filtered looks like this:

  <property name="secret" value="${env.DEV_SECRET}" context="dev" />
  <property name="secret" value="${env.PROD_SECRET}" context="prod" />

With 3.3.1 the values are replaced with the correct env variables and in the newer versions it is being unchanged.

This could also be incorrect configuration that we have that has happened to have been working in previous versions and might be a variation of this bug: #453 and submitting it as a new bug in case it is a user failure where we should have configured it differently.

Activity

  1. rzo1 commented on May 5, 2026

    @rzo1

    @mawiesne and I are experiencing a similar issue when performing property replacements in configuration files using the Maven Resource Plugin (3.5.0). It works with 3.3.1

  2. rzo1 commented on May 5, 2026

    @rzo1

    Here is an IT as reproducer: rzo1@396eda0

  3. rzo1 commented on May 5, 2026

    @rzo1

    I did a bisect and it points to 493aa46 which is bumping the maven-filtering dependency. The regression is therefore not in maven-resources-plugin itself but in the upstream org.apache.maven.shared:maven-filtering library, between its 3.3.1 and 3.3.2 releases.

    Maybe you can have a look @slawekjaranowski ?

  4. rzo1 commented on May 5, 2026

    @rzo1

    Added some details in apache/maven-filtering#333 and bisected the commit, which introduced the change in behaviour. Guess it needs to be fixed in maven-filtering (the repro IT could still be picked here, so it can be seen earlier).

  5. Zialus commented on Jun 30, 2026

    @Zialus

    I'm still running into this issue with version 3.5.0

  6. cstamas commented on Jun 30, 2026

    @cstamas
    Member

    IIUC:

    • change that is needed in maven-filtering, is already merged?
    • basically just a new maven-filtering release is needed?
  7. rzo1 commented on Jun 30, 2026

    @rzo1

    Yes @cstamas πŸ˜€

  8. cstamas commented on Jun 30, 2026

    @cstamas
    Member
  9. cstamas commented on Jul 3, 2026

    @cstamas
    Member
  10. Zialus commented on Jul 26, 2026

    @Zialus

    Any chance we can get the dependency version bump?

  11. cstamas commented on Jul 26, 2026

    @cstamas
    Member

    It is done on 3.x branch, so you are asking about release?

    As until then, you can just "redefine" maven resource plugin dependency, but explicitly adding dependency on maven-filtering 3.5.1 to it?

  12. gnodet commented on Sep 23, 2026

    @gnodet
    Contributor

    This was fixed by bumping maven-filtering to 3.5.1 in commit 1f8a00e.

    The root cause was a regression introduced in maven-filtering 3.3.2 that broke the "first <resource> entry wins" semantics for overlapping resource declarations. It was fixed in maven-filtering 3.5.1 (see apache/maven-filtering#333 and apache/maven-filtering#334).

    The fix will be included in the upcoming maven-resources-plugin 3.5.1 release. In the meantime, you can work around it by adding an explicit dependency on maven-filtering 3.5.1 in the plugin's <dependencies> block.

  13. added 2 commits that reference this issue on Sep 26, 2026
    c590600
    2fd5ef5
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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions