解决maven控制台出现乱码情况

"C:\Program Files\Java\jdk-10.0.2\bin\java.exe" -Dmaven.multiModuleProjectDirectory=H:\maven_web -Dmaven.home=H:\Maven\apache-maven-3.5.2 -Dclassworlds.conf=H:\Maven\apache-maven-3.5.2\bin\m2.conf "-javaagent:H:\idea\IntelliJ IDEA 2018.3\lib\idea_rt.jar=54564:H:\idea\IntelliJ IDEA 2018.3\bin" -Dfile.encoding=UTF-8 -classpath H:\Maven\apache-maven-3.5.2\boot\plexus-classworlds-2.5.2.jar org.codehaus.classworlds.Launcher -Didea.version=2018.3 tomcat:run
[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] Building maven_web Maven Webapp 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> tomcat-maven-plugin:1.1:run (default-cli) > compile @ maven_web >>>
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ maven_web ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory H:\maven_web\src\main\resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ maven_web ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 1 source file to H:\maven_web\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] ����֧��Դѡ�� 5����ʹ�� 6 ����߰汾��
[ERROR] ����֧��Ŀ��ѡ�� 1.5����ʹ�� 1.6 ����߰汾��
[INFO] 2 errors 
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.172 s
[INFO] Finished at: 2019-06-23T22:32:27+08:00
[INFO] Final Memory: 12M/50M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project maven_web: Compilation failure: Compilation failure: 
[ERROR] ����֧��Դѡ�� 5����ʹ�� 6 ����߰汾��
[ERROR] ����֧��Ŀ��ѡ�� 1.5����ʹ�� 1.6 ����߰汾��
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

Process finished with exit code 1

解决:maven默认环境为jdk,只需要改如下即可:
在IDEA中,打开File | Settings | Build, Execution, Deployment | Build Tools | Maven | Runner在VM Options中
添加-Dfile.encoding=GBK,切记一定是GBK。即使用UTF-8的话,依然是乱码,这是因为Maven的默认平台编码是GBK,
如果你在命令行中输入mvn -version的话,会得到如下信息,根据Default locale可以看出

  • 43
    点赞
  • 39
    收藏
    觉得还不错? 一键收藏
  • 20
    评论
评论 20
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值