最近在新建一个手脚架 maven 项目。package 时候一直抱了 Warn,虽然包还是可以打出来,但是看着 warn 就很不舒服:
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ calPush ---
[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!
Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!
查了一下 maven 的 FAQ 官网。参考官网的问题描述:How do I prevent “[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!”。这个问题主要是因为没有指定 encode 引起的。在 pom.xml 加上这段就可以了:
<project>
...
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
...
</project>