gnodet commented on PR #303: URL: https://github.com/apache/maven-filtering/pull/303#issuecomment-5814097172
Thank you for the contribution — this addresses a real pain point for projects that keep binary and filterable resources together in a single `<resource>` block. After discussion, we've decided to solve this more completely rather than silently catching `MalformedInputException`. The concerns with the current approach are: 1. **Silent failure** — catching the exception with no opt-in means encoding errors that *are* real mistakes get swallowed too, making them harder to diagnose. 2. **Recursive re-entry** — the fallback calls `copyFile(from, to, encoding, null, overwrite)` back into the same method rather than using `Files.copy()` directly. 3. **Insufficient for all cases** — extension-less binaries and path-based exclusions (e.g. all files under `certs/`) are not addressed by extension matching. We've opened two issues to track a clean solution: - **maven-filtering #394** — Add `nonFilteredFiles` (Ant-style glob list) to `Resource`, and an opt-in `gracefulBinaryHandling` flag with a proper `WARN` log: https://github.com/apache/maven-filtering/issues/394 - **maven-resources-plugin #521** — Expose both as user-facing plugin config (`<nonFilteredFiles>` per-resource, `<gracefulBinaryHandling>` global): https://github.com/apache/maven-resources-plugin/issues/521 The design: - **`<nonFilteredFiles>`** — per-resource Ant globs, explicit opt-out for known binaries (no surprise) - **`<gracefulBinaryHandling>`** — opt-in safety net that catches `MalformedInputException`, falls back to `Files.copy()`, and always emits a `WARN` so the user knows filtering was skipped PRs implementing both are in progress. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
