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:
1 2 3 4 5 6 7 8 | $ 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:
1 2 3 4 5 6 7 8 9 10 11 | <profile> <id>utf8</id> <properties> <project .build.sourceEncoding> UTF-8 </project> <project .reporting.outputEncoding> UTF-8 </project> </properties> </profile> |
The activate the utf8 profile with:
1 2 3 | <activeprofiles> <activeprofile>utf8</activeprofile> </activeprofiles> |
When you successfully added the profile you get this fancy info message in your maven builds:
1 | [INFO] Using 'UTF-8' encoding to copy filtered resources. |
Information about Data protection