Sunday, November 15, 2009

Maven2: [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!

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

Maven2 warning as above is because of the fact that maven2 plugins uses platform default encoding if no explicit file encoding has been provided in the plugin configuration. The usages of the platform encoding makes the build platform dependent hence the maven2 is bound to raise an alarm as build artifact/resources become irreproducible.

To suppress the Warning in maven2 environment we have to use the properties as below
<project>
...
<properties>
<project.build.sourceEncoding>${default.encoding}</project.build.sourceEncoding>
...
</properties>
...
</project>

cheers,
make world open.

3 comments:

Anonymous said...

This does not seem to work with Maven 2.2.1. There I have to hard code the encoding to make the warning disappear.

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

Pravin Kumar said...

Good one...helpful..

John Sherwood said...

Just what I needed. Odd I've never encountered this before...