-
在末尾加上 -Dfile.encoding=utf-8
-
Setting->maven->runner
VMoptions: -Dfile.encoding=GB2312 -
在 idea64.exe.vmoptions 文件尾加上
-Dfile.encoding=UTF-8
-
pom.xml中添加plugin: 指定测试时的编码类型
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.5</version>
<configuration>
<forkMode>once</forkMode>
<argLine>-Dfile.encoding=UTF-8</argLine>
<includes>
<include>**/*Test.java</include>
</includes>
<excludes>
</excludes>
</configuration>
</plugin>
- 修改pom.xml
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
</properties>