Windows系统下,如何设置maven字符编码

本地安装maven,查看:maven -v

mvn -version
Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
Maven home: C:\MyProgram\apache-maven-3.8.1\bin\..
Java version: 1.8.0_281, vendor: Oracle Corporation, runtime: C:\MyProgram\Java\jdk1.8.0_281\jre
Default locale: zh_CN, platform encoding: GBK
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

 

 

如何改为utf-8编码呢?

添加系统环境变量

MAVEN_OPTS

-Xms256m -Xmx512m -Dfile.encoding=UTF-8

Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
Maven home: C:\MyProgram\apache-maven-3.8.1\bin\..
Java version: 1.8.0_281, vendor: Oracle Corporation, runtime: C:\MyProgram\Java\jdk1.8.0_281\jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

 

 

注意:

更改环境变量后,要重新打开新的命令行窗口

 

posted @ 2021-12-20 19:58  joshua317  阅读(230)  评论(0编辑  收藏  举报