[MRESOURCES-162] Add failOnMissingFilterValue option to fail build on unresolved filter tokens - #408
Merged
gnodet merged 1 commit intoSep 26, 2026
Conversation
gnodet-bot
reviewed
Sep 25, 2026
gnodet-bot
left a comment
There was a problem hiding this comment.
Solid implementation — opt-in, backward-compatible, properly threaded through the filter chain, and well-tested. One observation on an edge case in InterpolatorFilterReaderLineEnding.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
gnodet-bot
approved these changes
Sep 25, 2026
gnodet-bot
left a comment
There was a problem hiding this comment.
Re-review after 82412c6 — the fix correctly addresses the core detection bug.
Previous finding status:
- Addressed: The null-check issue is fixed. The plexus interpolator returns the original expression for unresolved tokens (not
null), and the new code detects this viavalue.equals(key.toString())comparison. BothInterpolatorFilterReaderLineEndingandMultiDelimiterInterpolatorFilterReaderLineEndingare updated consistently. - Acknowledged (non-blocking): The
end != 0behavioral asymmetry I flagged previously (unterminated tokens throw in strict mode forInterpolatorFilterReaderLineEndingbut are silently passed through inMultiDelimiterInterpolatorFilterReaderLineEnding) is intentionally left as-is. This is a reasonable design choice — users opting into strict mode likely want malformed expressions flagged too.
The implementation is solid: opt-in flag, backward-compatible default, properly threaded through the filter chain, and tested for both enabled/disabled paths.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
slawekjaranowski
approved these changes
Sep 26, 2026
gnodet
force-pushed
the
fix/mresources-162-fail-on-missing-filter-value
branch
from
September 26, 2026 17:07
82412c6 to
60d4030
Compare
… filter tokens (MRESOURCES-162) - Add `failOnMissingFilterValue` boolean to AbstractMavenFilteringRequest (default false, backward compatible) - Propagate flag through MavenResourcesExecution.copyOf() - Throw IOException on unresolved token in InterpolatorFilterReaderLineEnding and MultiDelimiterInterpolatorFilterReaderLineEnding when enabled - Detect unresolved tokens by comparing interpolated value to original key string (plexus interpolator returns original expression, not null) - Fixes apache/maven-resources-plugin#400 (MRESOURCES-162)
gnodet
force-pushed
the
fix/mresources-162-fail-on-missing-filter-value
branch
from
September 26, 2026 17:15
60d4030 to
820aed8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the feature requested in MRESOURCES-162 (apache/maven-resources-plugin#532): a configurable option to fail the build when a filter expression cannot be resolved, instead of silently passing the placeholder through to the output.
Changes
AbstractMavenFilteringRequest: addfailOnMissingFilterValueboolean (defaultfalse, backward compatible)MavenResourcesExecution.copyOf(): propagate the new fieldBaseFilter.Wrapper: thread the flag to the filter readerInterpolatorFilterReaderLineEnding: throwIOExceptionon unresolved token when enabledMultiDelimiterInterpolatorFilterReaderLineEnding: sameBehaviour
When
failOnMissingFilterValueisfalse(default): existing behaviour unchanged — unresolved${placeholder}is passed through as-is.When
failOnMissingFilterValueistrue: any placeholder that noValueSourcecan resolve throws anIOExceptionwith a message identifying the token (e.g.Unresolved filter token: '${missing.property}'). This propagates throughFilteringUtils→DefaultMavenFileFilter→DefaultMavenResourcesFiltering→MavenFilteringException, causing a build failure.Note on unresolved token detection
The plexus interpolator never returns
nullfor unresolved expressions — it returns the original expression string (e.g.${missing.property}). The unresolved token is detected by comparing the interpolated value to the original key string (value.equals(key.toString())).Consumer PR
apache/maven-resources-plugin#532 exposes this as
@Parameter(property="maven.resources.failOnMissingFilterValue")on the Mojo.