103

When building using Maven on my mac, on mvn install i get

[WARNING] Using platform encoding (MacRoman actually) to copy filtered resources, i.e. build is platform dependent!

Is it possible to either build for a given platform (Linux) or otherwise make build platform independent?

Cale Sweeney
  • 1,014
  • 1
  • 15
  • 37
James Raitsev
  • 92,517
  • 154
  • 335
  • 470

3 Answers3

191

It happens when you have not provided following in your pom.xml

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

Absence of this means you are using platform specific encoding and that's why the warning.

Ripon Al Wasim
  • 36,924
  • 42
  • 155
  • 176
Kalpak Gadre
  • 6,285
  • 2
  • 24
  • 30
  • 4
    You also can find the solution in Maven's FAQ page. [http://maven.apache.org/general.html#encoding-warnin](http://maven.apache.org/general.html#encoding-warning) – Jeff7566 Oct 13 '14 at 05:54
  • Yes, after adding the lines mentioned in your answer, mine is working well without warning. thanks Kal – Ripon Al Wasim May 15 '15 at 10:22
7

And if @Kal's answer doesn't work for you, perhaps you can learn from my last 30 minutes... below link adds an additional line to the above answer and solved my problem. My problem was related to the maven-resources-plugin 2.6, but the provider of the following solution had a different problem it solved... https://stackoverflow.com/a/3018152/2485075

Community
  • 1
  • 1
Mike
  • 916
  • 12
  • 14
  • 1st line of my pom.xml is: I found the same warning in Windows 7: [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! – Ripon Al Wasim May 15 '15 at 10:15
1

For specific needs:

<!-- https://maven.apache.org/plugins/maven-resources-plugin/index.html -->
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-resources-plugin</artifactId>
    <version>3.1.0</version>
    <configuration>
        <encoding>UTF-8</encoding>
    </configuration>
</plugin>

If the plugin is already configured one should merely add

<encoding>UTF-8</encoding>