gnodet opened a new pull request, #534:
URL: https://github.com/apache/maven-resources-plugin/pull/534
When `<filtering>true</filtering>` is set on a resource directory, all text
files undergo
property substitution. Binary files (keystores, certificates, etc.) whose
extensions are not in the
built-in exclusion list get corrupted.
The `nonFilteredFileExtensions` parameter works globally by extension, but
users sometimes need
**pattern-based** control at the individual resource level — e.g. exempting
`**/*.p12` or `certs/**`
from filtering while keeping everything else filtered.
## What this PR does
maven-filtering's `Resource` class already has a `nonFilteredFiles` field
(since 3.4.0) that accepts
Ant-style glob patterns. The filtering engine already checks it via
`matchesNonFilteredGlob()`.
This PR makes the feature discoverable and tested from the resources plugin
side:
1. **Documents availability** — Users can configure `<nonFilteredFiles>`
inside each `<resource>`
block in the plugin's `<configuration>` section.
2. **Improved error message** — When a `MalformedInputException` occurs
(binary file hit by
filtering), the error now mentions `<nonFilteredFiles>` as an option
alongside
`nonFilteredFileExtensions`.
3. **Integration test** (`MRESOURCES-521`) — Verifies that a binary `.p12`
file matched by
`**/*.p12` is copied byte-for-byte while a `.properties` file in the same
resource directory
is still filtered normally.
## Example configuration
```xml
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<resources>
<resource>
<filtering>true</filtering>
<directory>src/main/resources</directory>
<nonFilteredFiles>
<nonFilteredFile>**/*.p12</nonFilteredFile>
<nonFilteredFile>certs/**</nonFilteredFile>
</nonFilteredFiles>
</resource>
</resources>
</configuration>
</plugin>
```
> **Note:** `<nonFilteredFiles>` is configured in the plugin's
`<configuration><resources>` block
> (not in the POM model's `<build><resources>`), because the POM model's
`<resource>` element
> does not define this child. The plugin's `@Parameter List<Resource>` uses
maven-filtering's
> `Resource` POJO which supports the field natively.
Fixes #521
--
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]