编译译时出现 [WARNING] File encoding has not been set, using platform encoding MacRoman , 则修改pom.xml,加入一下内容:
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
结果:
[INFO] Using 'UTF-8' encoding to copy filtered resources.
- 运行 mvn javadoc:javadoc后,网页显示乱码. 解决方法:让javadoc插件使用UTF-16或Unicode字符集:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<charset>UTF16</charset>
</configuration>
</plugin>
</plugins>
</build>