Skip to content

feat: expose gracefulBinaryHandling parameter - #536

Merged
gnodet merged 1 commit into
apache:masterfrom
gnodet:feat/graceful-binary-handling
Sep 30, 2026
Merged

gnodet merged 1 commit into
apache:masterfrom
gnodet:feat/graceful-binary-handling

Conversation

@gnodet

@gnodet gnodet commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Exposes maven-filtering's gracefulBinaryHandling option that was previously inaccessible from maven-resources-plugin.

When set to true, binary files that trigger a MalformedInputException during filtering (i.e. unreadable as text in the configured charset) are silently copied as-is instead of failing the build. A WARN log is emitted for each skipped file, pointing users toward the preferred targeted approaches.

Configuration

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-resources-plugin</artifactId>
  <configuration>
    <gracefulBinaryHandling>true</gracefulBinaryHandling>
  </configuration>
</plugin>

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

Guidance

This is a last-resort fallback for heterogeneous resource directories where it is not practical to enumerate every binary extension. Prefer the targeted approaches:

Changes

  • ResourcesMojo.java: new @Parameter(property = "maven.resources.gracefulBinaryHandling", defaultValue = "false") wired to MavenResourcesExecution.setGracefulBinaryHandling()
  • IT MRESOURCES-graceful-binary: binary .p12 in a filtered resource directory — build succeeds, binary copied byte-for-byte, text .properties file filtered normally

@gnodet
gnodet requested a review from rmannibucau September 30, 2026 09:28

@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.

Solid feature — clean wiring, good IT coverage, sane default. One tag needs fixing.

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

Comment thread src/main/java/org/apache/maven/plugins/resources/ResourcesMojo.java Outdated
Comment thread src/main/java/org/apache/maven/plugins/resources/ResourcesMojo.java Outdated
@gnodet gnodet added enhancement New feature or request java Pull requests that update Java code labels Sep 30, 2026
- Add gracefulBinaryHandling parameter (default: false) that silently copies binary files triggering MalformedInputException instead of failing the build; a WARN log is emitted for each skipped file
- Surfaces maven-filtering's gracefulBinaryHandling option previously inaccessible from maven-resources-plugin
- Add @SInCE 3.4.0 javadoc tag and integration test coverage
@gnodet
gnodet force-pushed the feat/graceful-binary-handling branch from c522054 to 0b4ba4a Compare September 30, 2026 12:40
@gnodet
gnodet merged commit 71d4867 into apache:master Sep 30, 2026
1 check passed
@github-actions github-actions Bot added this to the 4.0.0-beta-2 milestone Sep 30, 2026

@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 c522054. Both previous findings addressed:

  1. @since tag — fixed to 4.0.0-beta-2 ✅
  2. "silently skipped" wording — removed contradictory "silently" ✅

Clean feature: one @Parameter boolean wired to MavenResourcesExecution, good Javadoc with appropriate caveats, solid IT covering both the binary pass-through and text filtering. No issues.

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

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.

3 participants