2012-04-30 30 views
0

這是一個跟進set file.encoding from pom.xml。 我需要確保Charset.defaultCharset()返回UTF-8。 當我運行時從`pom.xml`設置`defaultCharset`

JAVA_TOOL_OPTIONS='-Dfile.encoding=UTF-8' mvn clean compile test package 

我明白了。然而,我不能控制mvn是如何被調用的,所以我需要將一些東西放入pom.xml,這會將默認字符集設置爲utf-8。 哪個systemPropertyVariables設置?

編輯: 我有

<properties> 
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
</properties> 

<configuration> 
    <systemPropertyVariables> 
    <file.encoding>${project.build.sourceEncoding}</file.encoding> 
    <charset>${project.build.sourceEncoding}</charset> 
    </systemPropertyVariables> 
</configuration> 

他們不幫助。 defaultCharset仍然是US-ASCII

回答