How To Set The Encoding Using Maven

5 years ago by in How To, Maven Tagged: ,

The file encoding can be set through the properties as shown in the following pom fragment.

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

It is highly recommended to set the files encoding. Note that if unset, the OS default encoding is used, which vary between different OSes. This may cause compilation problems when files are shared with different OSes especially when using any special characters, such as ö.

Albert Attard

Albert Attard is a Java passionate and technical lead at a research group. You can find him on . Over the past years Albert worked on various Java projects including traditional server/client applications, modular applications, large data handling applications and concurrent data manipulation applications to name a few. He has a BSc degree from the University of London (Homepage) and an MSc Information Security with the same university. His MSc thesis (Book) received the 2012 SearchSecurity.co.UK award (Website).

Leave a Comment


Time limit is exhausted. Please reload the CAPTCHA.