Skip to content

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

Merged
gnodet merged 1 commit into
apache:masterfrom
gnodet:fix/mresources-162-fail-on-missing-filter-value
Sep 30, 2026
Merged

gnodet merged 1 commit 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.

@gnodet
gnodet force-pushed the fix/mresources-162-fail-on-missing-filter-value branch 2 times, most recently from c855917 to 0993aec Compare September 27, 2026 23:47
@gnodet gnodet added this to the 4.0.0-beta-2 milestone Sep 28, 2026
@gnodet
gnodet marked this pull request as ready for review September 28, 2026 18:20

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean, focused PR. One finding on the @since tag.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review after NEW_COMMENTS signal. The previous finding about @since is still unresolved.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed after 15bdfa5. The @since tag is now correctly set to 4.0.0-beta-2 — previous finding addressed. No other issues.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

@gnodet gnodet added enhancement New feature or request java Pull requests that update Java code labels Sep 30, 2026
@gnodet
gnodet force-pushed the fix/mresources-162-fail-on-missing-filter-value branch from 15bdfa5 to bea4575 Compare September 30, 2026 07:17
…lter tokens (MRESOURCES-162)

- Add boolean `failOnMissingFilterValue` parameter (default: `false`) to `ResourcesMojo`
  that causes the build to fail when a filter expression cannot be resolved, instead of
  silently passing the placeholder through to the output
- Wired into `MavenResourcesExecution` (requires maven-filtering 4.0.0-beta-3+)
- Configurable via POM or `-Dmaven.resources.failOnMissingFilterValue=true`
- Default `false` preserves full backward compatibility
- Add IT `MRESOURCES-162-fail`: verifies build fails with unresolved token in error message
- Add IT `MRESOURCES-162-pass`: verifies default behavior passes placeholder through

Closes apache#400
@gnodet
gnodet force-pushed the fix/mresources-162-fail-on-missing-filter-value branch from bea4575 to 056b9ba Compare September 30, 2026 07:17
@gnodet
gnodet merged commit b1325c3 into apache:master Sep 30, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request java Pull requests that update Java code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

3 participants