Require Encoding
This rule checks files for a required encoding and fails if the guessed encoding doesn't match the required one.
Note that this rule uses icu4j to guess the source encoding of a file. Use of US-ASCII is hard to detect and should not be used as a required encoding.
The following parameters are supported by this rule:
- encoding - Required encoding. Default value 
${project.build.sourceEncoding}. - includes - List of files to include, separated by comma or pipe
 - excludes - List of files to exclude, separated by comma or pipe
 - useDefaultExcludes - enable SCM file exclusions, enbled by default.
 - failFast - Should the rule fail after the first error or should the errors be aggregated. Default true.
 - acceptAsciiSubset - a boolean, accept US-ASCII as an subset of UTF-8 and ISO-8859-1/-15, default 
false. - acceptIso8859Subset - a boolean, accept ISO-8859-1 as a subset of ISO-8859-15, default 
false. 
Sample Plugin Configuration:
<project>
  [...]
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>3.6.2</version> <!-- find the latest version at http://maven.apache.org/plugins/maven-enforcer-plugin/ -->
        <executions>
          <execution>
            <id>require-utf-8</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requireEncoding>
                  <encoding>UTF-8</encoding>
                  <includes>src/main/resources/**,src/test/resources/**</includes>
                  <failFast>false</failFast>
                </requireEncoding>
              </rules>
            </configuration>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>extra-enforcer-rules</artifactId>
            <version>1.11.0</version>
          </dependency>
        </dependencies>
      </plugin>
    </plugins>
  </build>
  [...]
</project>Trademarks
Apache, Apache Maven, Maven and the Apache feather logo are trademarks of The Apache Software Foundation.


