我在Mac上通过MVN清洁测试运行测试,控制台输出如下所示:
\u8F93\u5165\u6B63\u5E38\u53C2\u6570uid\u548Climit\uFF0C\u6570\u636E\u5E93\u65E0\u8BB0
信息:
Apache Maven 3.0.3 (r1075438; 2011-03-01 01:31:09+0800)
Maven home: /usr/local/apache-maven-3.0.3
Java version: 1.6.0_33, vendor: Apple Inc.
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x", version: "10.7.4", arch: "x86_64", family: "mac"
我的测试用例用中文编写。如何设置测试结果编码?
由于
答案 0 :(得分:2)
您必须在pom.xml中设置以下内容:
<project>
...
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
...
</project>
您可能需要使用以下内容来增强它:
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>