【异常】File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!

发布时间 2023-12-14 23:12:10作者: 清清飞扬

From: https://www.cnblogs.com/duanxianyouyang/p/14679926.html

File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!

解决方法:在pom中增加以下配置

<properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

  

另一个表现就是:mvn编译成功,但是程序运行时却出现错误,大致是编码问题导致的!