Apache

Docs Plugins

Resources Plugin 3.5.0 · Other versions

The Resources Plugin handles the copying of project resources to the output directory. There are two different kinds of resources: main resources and test resources. The difference is that the main resources are the resources associated with the main source code while the test resources are associated with the test source code. Thus, this allows the separation of resources for the main source code and its unit tests.

Source
Edit this page
Wrong?
Report a problem

Specifying a character encoding scheme

A character encoding scheme such as ASCII, UTF-8 or UTF-16 can be chosen to be used for the reading and writing of files.

The best practice is to define encoding for copying filtered resources via the property ${project.build.sourceEncoding} which should be defined in the pom properties section like this:

<project ...>
 ...
 <properties>
   <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
   ...
 </properties>
 ..
</project>

By using the above property maven-resources-plugin will automatically use this encoding.

Occasionally you need to change the encoding explicitly for different purposes. This can be done by defining the encoding via the configuration like this:

<project>
  ...
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <version>3.5.0</version>
        <configuration>
          ...
          <encoding>UTF-8</encoding>
          ...
        </configuration>
      </plugin>
    </plugins>
    ...
  </build>
  ...
</project>