eclipse–>run as –> maven test 中文乱码
方法1,参考:https://blog.csdn.net/zhch152/article/details/39584053
修改项目部分 pom.xml 代码:
<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>
方法2,参考:https://blog.csdn.net/lht0211/article/details/11880881
在Maven的pom.xml文件中增加:
<properties>
<argLine>-Dfile.encoding=UTF-8</argLine>
</properties>