Problem
maven-resources-plugin exposes <nonFilteredFileExtensions> for bypassing text filtering on binary files, but this is insufficient for projects that:
- Have extension-less binary files (test keystores, generated fixtures)
- Want path-based exclusions (e.g. all files under
src/main/resources/certs/)
- Want to be surgical per
<resource> block rather than globally
See #303 for a concrete user report.
Proposed Solution
Once maven-filtering adds List<String> nonFilteredFiles to Resource (companion issue), expose it in ResourcesMojo and TestResourcesMojo as:
Per-resource config (primary — per <resource> block)
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<nonFilteredFiles>
<nonFilteredFile>**/*.p12</nonFilteredFile>
<nonFilteredFile>**/*.jks</nonFilteredFile>
<nonFilteredFile>**/certs/**</nonFilteredFile>
<nonFilteredFile>binary-file</nonFilteredFile>
</nonFilteredFiles>
</resource>
Global opt-in graceful binary fallback (safety net)
Add a <gracefulBinaryHandling> boolean parameter (default false) at the Mojo level, propagated to MavenResourcesExecution.setGracefulBinaryHandling(true). When enabled, files that cause MalformedInputException during filtering are copied as-is with a WARN log rather than crashing the build.
<configuration>
<gracefulBinaryHandling>true</gracefulBinaryHandling>
</configuration>
See also
Problem
maven-resources-pluginexposes<nonFilteredFileExtensions>for bypassing text filtering on binary files, but this is insufficient for projects that:src/main/resources/certs/)<resource>block rather than globallySee #303 for a concrete user report.
Proposed Solution
Once
maven-filteringaddsList<String> nonFilteredFilestoResource(companion issue), expose it inResourcesMojoandTestResourcesMojoas:Per-resource config (primary — per
<resource>block)Global opt-in graceful binary fallback (safety net)
Add a
<gracefulBinaryHandling>boolean parameter (defaultfalse) at the Mojo level, propagated toMavenResourcesExecution.setGracefulBinaryHandling(true). When enabled, files that causeMalformedInputExceptionduring filtering are copied as-is with aWARNlog rather than crashing the build.See also
Resource.nonFilteredFilesfield and the graceful fallback flag