In Maven it’s easy to set the encoding for your source code to a defined encoding (e.g. UTF-8) by inserting this part into your pom file:
But how to apply this to your Eclipse project?
Until now I committed some of the resources used by Eclipse to the repository to have a consistent behavior for all developers. For the encoding, this is the file “.settings/org.eclipse.core.resources.prefs” containing:
encoding/
eclipse.preferences.version=1
Unfortunately the maven-eclipse-plugin doesn’t provide a property to set this when running “mvn eclipse:eclipse”.
But there is a generic
=${project.build.sourceEncoding}
eclipse.preferences.version=1
]]>
And that even works using parent poms. So you only have to defin e that once for a project that consists of multiple Eclipse projects.