Usage

Escape Unicode Maven File Filter is a Plexus Component that should just work in any maven-plugin that uses Apache Maven Filtering version 3.1.1. With that said, the only maven-plugin that has been tested is maven-resources-plugin version 3.0.1.

To enable the Escape Unicode Maven File Filter in maven-resources-plugin, use the following snippet:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-resources-plugin</artifactId>
  <version>3.0.1</version>
  <dependencies>
    <dependency>
      <groupId>org.polago.maven.shared.filtering</groupId>
      <artifactId>escape-unicode-file-filter</artifactId>
      <version>2.0</version>
    </dependency>
  </dependencies>
</plugin>

This will replace the DefaultMavenFileFilter with EscapeUnicodeMavenFileFilter and all non-ASCII characters will be replaced by the corresponding java escape sequence in all properties files processed by maven-resources-plugin. The filter will always use ISO-8859-1 as input encoding for all properties files.

The filter identify properties files by matching file names against a regex that by default is .*\.properties$.

Since there is no way to configure the filter from the Maven POM, there is a system property that may be used to change the regex. The system property is org.polago.maven.shared.filtering.escapeunicode.EscapeUnicodeMavenFileFilter.pattern.