我沒有辦法來測試這一點,但不妨一試:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.9</version>
<configuration>
<project>
<properties>
<user.language>en</user.language>
<user.region>GB</user.region>
</properties>
</project>
<includes>
<include>**/*Test.java</include>
</includes>
<forkMode>pertest</forkMode>
</configuration>
</plugin>
編輯:OK試試這個:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.9</version>
<configuration>
<systemPropertyVariables>
<user.language>en</user.language>
<user.region>GB</user.region>
</systemPropertyVariables>
<includes>
<include>**/*Test.java</include>
</includes>
<forkMode>pertest</forkMode>
</configuration>
</plugin>
您是否嘗試過設置'user.country'而不是'user.region'? – 2012-01-23 13:42:25
設置國家不起作用。它將它設置爲系統屬性就好了,不會以任何方式影響Locale。 – JHollanti 2012-01-24 09:49:27
Sun的文檔[1]指出: 「第二,在某些Java運行時實現中,應用程序用戶可以通過設置user.language,user.country和user來在命令行上提供此信息來覆蓋主機的默認語言環境。變體系統屬性「。 那麼,您使用的是哪種JVM? [1] http://java.sun.com/developer/technicalArticles/J2SE/locale/ – 2012-01-24 11:02:35