I am setting up several projects on a continuous integration server, some of which I don't have access to change the source code to, The server is a linux box, I am running into a problem where maven encoding needs to be changed to UTF8 to be able to compile on the box. Since I don't have access to modify the pom file, I was wondering if I can pass the compiler options as a command-line param? The project uses maven compiler 2.0 and I tried passing -Denconding=UTF8 without success.
+1
A:
You can use the Maven property "project.build.sourceEncoding".
So something along the lines of
mvn clean install -Dproject.build.sourceEncoding=UTF-8
should accomplish what you need.
This is equivalent of
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
in your pom.xml.
Edit: As a point of reference, there is the following link available POM Element for Source File Encoding showing the nuances between these properties for both Maven 2.0 and 3.0
apiri
2010-07-01 20:18:34
This does not work. In the link you reference it says it is available for maven compiler plugin starting 2.1, as I said above, the pom uses 2.0
shipmaster
2010-07-01 21:05:14
I will accept the answer because it doesn't look like there is a way to do it with old compiler plugin :(
shipmaster
2010-07-06 16:20:59