File encoding has not been set, using platform encoding UTF-8
错误原因
maven 打包编译时后台一直输出警告信息:
[WARNING] File encoding has not been set, using platform encoding GBK, i.e. build is platform dependent!
解决方案
在pom.xml文件中增加一个配置项即可:
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
Error running 'cache [compile]': No valid Maven installation found. Either set the home directory in the configuration dialog or set the M2_HOME environment variable on your system.
关于这个错误的原因,这里面的提示很明确了。
- 没有定义环境变量:M2_HOME
- IDEA Maven 的 Home 目录是错误的
从这两方面下手就行了,IDEA 的话可以更改配置:
同时也修改新创建的项目配置,否则创建的还是没有改变,按照图片中配置新创建项目的 settings:
除了 Home 目录之外,下面的配置目录页需要抱持一致在 Home 目录的的 conf/settings;
Q.E.D.
Comments | 0 条评论