首先在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命令试试
标签:maven,Java,windows,11.0,idea,乱码,version From: https://www.cnblogs.com/abel-he/p/17014064.html