Checklist when working with Java Sourcefiles that contain special chars (like umlauts):
  • Save file in UTF-8 format
  • Tell Eclipse to use UTF-8:
    Project properties -> Resource -> Text file enconding: "Other (UTF-8)"
  • Tell Maven (pom.xml) to use UTF-8:
    <properties>
      <project.build.sourceEncoding>UTF-8 </project.build.sourceEncoding>
    </properties>
    <build>
      <plugins>
        <plugin>
          <artifactId>maven-compiler-plugin</artifactId>
          <configuration>
            <encoding>UTF-8</encoding>
          </configuration>
        </plugin>
        <plugin>
          <artifactId>maven-surefire-plugin</artifactId>
          <configuration>
            <argLine>-Dfile.encoding=UTF-8</argLine>
          </configuration>
        </plugin>
      </plugins>
    </build>
Note: The Surefire configuration is needed if there are unittests that read from UTF8-textfiles. Setting the property via “<systemProperties>” or “MAVEN_OPTS” doesn’t work.
For “project.build.sourceEncoding” see http://docs.codehaus.org/display/MAVENUSER/POM+Element+for+Source+File+Encoding