December 14, 2012

OSX platform encoding in Maven


By default Maven uses the operating system platform encoding for the build. On OSX this is MacRoman. This leads to warnings that the build is platform dependent:

$ mvn clean package
[INFO] Scanning for projects...

[WARNING] File encoding has not been set, using platform encoding MacRoman, 
i.e. build is platform dependent!

To fix this you just have to add the following profile to your ~/.m2/setting.xml:


The activate the utf8 profile with:


When you successfully added the profile you get this fancy info message in your maven builds:

[INFO] Using 'UTF-8' encoding to copy filtered resources.


encoding, Mac OS X, MacRoman, maven, utf8

You may also like

Leave a Reply

Your email address will not be published. Required fields are marked

Information about Data protection

This site uses Akismet to reduce spam. Learn how your comment data is processed.

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}