idea maven 命令后控制台乱码

首先在idea中查看maven的编码方式

mvn -v

Maven home: D:\apache-maven-3.6.3\bin\..
Java version: 11.0.17, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk-11.0.17
Default locale: zh_CN, platform encoding: GBK
OS name: "windows 11", version: "10.0", arch: "amd64", family: "windows"

在系统环境变量中,添加变量(变量名:MAVEN_OPTS,变量值:-Dfile.encoding=UTF-8),如下图

 

 

 重启idea之后之后重新查看maven的编码方式

mvn -v
Maven home: D:\apache-maven-3.6.3\bin\..
Java version: 11.0.17, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk-11.0.17
Default locale: zh_CN, platform encoding: UTF-8
OS name: "windows 11", version: "10.0", arch: "amd64", family: "windows"

重新执行maven命令试试 

posted @ 2023-07-28 17:16  译林  阅读(495)  评论(0编辑  收藏  举报