Howto use maven in a heterogenous environment with different encodings?

encoding, linux, maven-2, svn, windows

Solution

No, the maven compiler plugin doesn't use the `project.build.sourceEncoding` property. So you need to configure the file encoding for it (I'd use UTF-8):

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-compiler-plugin</artifactId>
  <configuration>
    <encoding>UTF-8</encoding>
  </configuration>
</plugin>

Problem

I've created a svn repositoy on a linux server (Debian) and used a client on a windows machine to check my java sources in. Now I've set up a Hudson server on a different linux server (Ubuntu) to periodically run tests on my code. But the tests fail with a compiler error: ``` Error: unmappable character for encoding ASCII ``` On my windows machine I've used the default encoding Cp1252. On my svn server I can do a local checkout of my sources and they look good. On my Hudson server the checkout contains illegal characters. What are the parameters I have to adjust so that all three systems use a working encoding? EDIT 2009-10-15: I changed the default encoding of my Ubuntu system to `latin1`. Now I can open the checkedout files with an editor and they look good (thanks to @John-T at superuser.com). But Hudson still complained about `unmappable character for encoding ASCII` and I found that this is caused by maven. I found an explantion, but the suggested solution didn't work. Now maven tells me that it uses `latin1` when copying some resources, but the compiler (not using this setting?) still complains with the same error message.

Original source