Wednesday, September 29, 2010

Maven: unmappable character for encoding UTF8

If maven keeps complaining about "unmappable character for encoding UTF8" you are most probably having some special characters within your source code like ä or á. Since your editor is not using UTF-8 as file encoding - like eclipse does not in default settings under windows (it uses platform-specific encoding Cp1252) - this will cause problems with the maven-compiler-plugin.

For quick-fixing this problem you might want to add the following to your pom.xml:

Set the encoding to whatever your source files are using. Anyway I would recommend to remove all the characters causing those problems and also change the default encoding to UTF-8 to be consistent with the maven defaults and not having to set this explicitly.

Generally not using special characters in source code should prevent those problems completely that might occur quickly again introduced by developers who for any reason do not use UTF-8 as default encoding again and the trouble will start anew.

No comments:

Post a Comment

Please leave your comment here.