用 eclipse-->run as --> maven test 就出现中文乱码
解决方法一:
<properties> <argLine>-Dfile.encoding=UTF-8</argLine> </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>
本文介绍了解决使用Eclipse进行Maven测试时遇到的中文乱码问题的方法。提供了两种解决方案,一种是在属性中设置文件编码为UTF-8,另一种是在Maven配置中加入特定插件设置。
1898

被折叠的 条评论
为什么被折叠?



