這是一個跟進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
。
我有這個,它沒有幫助。 – sds