maven启动中文乱码问题,不再支持源选项 5。请使用 6 或更高版本。File encoding has not been set, using platform encoding UTF-8,

  • 解决1:File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!

  • 解决2:不再支持源选项 5。请使用 6 或更高版本。 不再支持目标选项 1.5。请使用 1.6 或更高版本

  1. 两个问题在maven中的pom.xml文件中添加下面代码段
  <properties>
    <!--解决File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!-->
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <!--不再支持源选项 5。请使用 6 或更高版本。 不再支持目标选项 1.5。请使用 1.6 或更高版本-->
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
  </properties>
  1. 修改模块编译源的jdk版本为当前本地版本 project Structure -->Modules --> Sources
    在这里插入图片描述
  • 解决3 maven启动中文乱码问题:
    因为maven默认是GBK编码,IDEA是默认utf-8编码,故乱码。解决如下
    file --> Setting --> 搜索Maven --> maven --> Runner 中设置 VM Options为 -Dfile.encoding=GBK

在这里插入图片描述

在这里插入图片描述

发布了100 篇原创文章 · 获赞 6 · 访问量 4068

猜你喜欢

转载自blog.csdn.net/qq_38454176/article/details/104297249
今日推荐