This is a follow up to set file.encoding
from pom.xml
.
I need to make sure that Charset.defaultCharset() returns UTF-8.
When I run
JAVA_TOOL_OPTIONS='-Dfile.encoding=UTF-8' mvn clean compile test package
I get that. However, I do not have any control about how mvn
is invoked, so I need to put something into pom.xml
which would set the default charset to utf-8
.
Which systemPropertyVariables
do I set?
EDIT: I do have
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
and
<configuration>
<systemPropertyVariables>
<file.encoding>${project.build.sourceEncoding}</file.encoding>
<charset>${project.build.sourceEncoding}</charset>
</systemPropertyVariables>
</configuration>
they do not help. defaultCharset
is still US-ASCII
.