【解决方案一】
在Maven的pom.xml文件中增加如下代码:
<properties>
<argXLine>-Dfile.encoding=UTF-8</argXLine>
</properties>
【解决方案二】
<build>
<plugins>
<!-- 解决maven test命令时console出现中文乱码乱码 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.7.2</version>
<configuration>
<forkMode>once</forkMode>
<argLine>-Dfile.encoding=UTF-8</argLine>
<!-- <systemProperties> -->
<!-- <property> -->
<!-- <name>net.sourceforge.cobertura.datafile</name> -->
<!-- <value>target/cobertura/cobertura.ser</value> -->
<!-- </property> -->
<!-- </systemProperties> -->
</configuration>
</plugin>
</plugins>
</build>