Skip to content

Add failOnMissingFilterValue parameter to fail on unresolved filter tokens (MRESOURCES-162) - #532

Draft
gnodet wants to merge 2 commits into
apache:masterfrom
gnodet:fix/mresources-162-fail-on-missing-filter-value
Draft

gnodet wants to merge 2 commits into
apache:masterfrom
gnodet:fix/mresources-162-fail-on-missing-filter-value

Conversation

@gnodet

@gnodet gnodet commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Closes #400

Summary

Implements MRESOURCES-162: add a failOnMissingFilterValue parameter that causes the build to fail when a filter expression in a resource file cannot be resolved, instead of silently leaving the placeholder in the output.

Usage

<configuration>
  <failOnMissingFilterValue>true</failOnMissingFilterValue>
</configuration>

Or via command line:

-Dmaven.resources.failOnMissingFilterValue=true

When enabled, a resource file containing ${missing.property} (where missing.property is not defined) will fail with:

filtering src/main/resources/resource.txt failed with IOException: Unresolved filter token: '${missing.property}'

Changes

  • ResourcesMojo: add failOnMissingFilterValue @Parameter (default false, backward compatible), wired into MavenResourcesExecution
  • pom.xml: bump mavenFilteringVersion to 4.0.0-beta-2-SNAPSHOT (requires apache/maven-filtering#408)
  • Two ITs:
    • MRESOURCES-162-fail: verifies build fails with the unresolved token in the error message
    • MRESOURCES-162-pass: verifies default behavior (placeholder passed through as-is)

Dependency

This PR depends on apache/maven-filtering#408 which implements the detection in the filter readers. The mavenFilteringVersion will be updated to the released version once that PR is merged and released.

…okens (MRESOURCES-162)

Add a new boolean parameter 'failOnMissingFilterValue' (default: false) that causes the
build to fail when a filter expression in a resource file cannot be resolved, instead of
silently passing the placeholder through as-is to the output.

Configuration:
  <configuration>
    <failOnMissingFilterValue>true</failOnMissingFilterValue>
  </configuration>

Or via property:
  -Dmaven.resources.failOnMissingFilterValue=true

The feature is implemented in maven-filtering (PR apache#408). This PR bumps
mavenFilteringVersion to 4.0.0-beta-2-SNAPSHOT and wires the new parameter
into MavenResourcesExecution.

Includes two ITs:
- MRESOURCES-162-fail: failOnMissingFilterValue=true causes BUILD FAILURE with
  the unresolved token name in the error message
- MRESOURCES-162-pass: default behaviour (false) passes the placeholder through

Fixes: apache#400
@gnodet
gnodet force-pushed the fix/mresources-162-fail-on-missing-filter-value branch from 7ba6232 to ab13fd8 Compare September 26, 2026 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[MRESOURCES-162] Fail build if resource not fully filtered

1 participant