gnodet opened a new pull request, #406:
URL: https://github.com/apache/maven-filtering/pull/406

   ## Summary
   
   Allow users to specify a character encoding directly on a `<resource>` 
element in the plugin configuration. When set, the resource-level encoding 
takes priority over the global `encoding` parameter and `propertiesEncoding`, 
enabling different resource sets within the same execution to be processed with 
different encodings.
   
   ## Motivation
   
   Fixes: https://github.com/apache/maven-resources-plugin/issues/125 
(MRESOURCES-281)
   
   Mixed-encoding projects (e.g. legacy projects with `windows-1252` as the 
global encoding but with `*.xml`/`*.json` files that must be `UTF-8`) had no 
clean solution. The workaround was multiple plugin executions or separate 
source directories, both of which are cumbersome.
   
   ## Solution
   
   Add an `encoding` field to `Resource` in maven-filtering. The implementation 
in `DefaultMavenResourcesFiltering` checks for a resource-level encoding first; 
if absent, falls back to the existing `propertiesEncoding`/`encoding` logic 
unchanged.
   
   ## Usage
   
   ```xml
   <configuration>
     <resources>
       <resource>
         <directory>src/main/resources</directory>
         <encoding>UTF-8</encoding>
         <includes><include>**/*.xml</include></includes>
       </resource>
       <resource>
         <directory>src/main/resources</directory>
         <encoding>windows-1252</encoding>
         <excludes><exclude>**/*.xml</exclude></excludes>
       </resource>
     </resources>
   </configuration>
   ```
   
   ## Changes
   
   - `Resource.java`: add `encoding` field with getter/setter (`@since 3.4.0`)
   - `DefaultMavenResourcesFiltering.java`: check `resource.getEncoding()` 
before falling back to global encoding
   - New test `filterResourcesWithPerResourceEncoding()` with real UTF-8 and 
windows-1252 encoded test files


-- 
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]

Reply via email to