Wednesday, April 22, 2009

Encoding warning with Maven 2.1.0

Recently I updated Maven to newest release (2.1.0) for a new project. Upgrade from 2.0.9 was smooth and all existing build scripts were working fine. While glancing at the logs emitted by Maven found this warning message-

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

This warning message was not emitted by Maven 2.0.9. Reason of this warning message is that maven (plugins) use platform default encoding and it notifies the users about the build being platform dependent. This article (http://docs.codehaus.org/display/MAVENUSER/POM+Element+for+Source+File+Encoding) has detailed information about this change. Instead of using platform default encoding, Maven can be instructed to use any encoding by adding following property in the pom.xml

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


and it no longer emits the warning message.

14 Comments: