Java compiler level does not match the version of the installed Java project facet.-Dmaven.multiModu

1. Java compiler level does not match the version of the installed Java project facet.
今天用Eclipse时报这个错误:
Java compiler level does not match the version of the installed Java project facet.
 以前没有碰到过,花了半个多小时才搞定,现把解决办法记下来,免得下次再遇到这个问题又要花那么多时间。

问题原因:
Facted Project 中的Java 版本设定与项目的Java编译器的compliance level设定不一致。

解决办法:
把两者设置成相同。
第一步:查看Compiler compliance level
右键Project | Properties | Java Compiler(type filter text输入compiler可快速定位),如下图所示:

Java compiler level does not match the version of the installed Java project facet.-Dmaven.multiModu_第1张图片

根据图中显示可知,Compiler compliance level是6.0(当然您的项目该值很可能不是6.0)

第二步:修改Project Facets的Java值,使之和Compiler compliance level相同:
右键Project | Properties | Project Facets(type filter text输入facet可快速定位):

Java compiler level does not match the version of the installed Java project facet.-Dmaven.multiModu_第2张图片


=>选中Java那行
=>点击Modify Project...按钮
Java compiler level does not match the version of the installed Java project facet.-Dmaven.multiModu_第3张图片

=>修改Java的值,使之和Compiler compliance level相同(本例为6.0)

大功告成!



   2. Mac中Myeclipse中使用maven插件的时候,运行run as maven build的时候报错
-Dmaven.multiModuleProjectDirectory system propery is not set. Check $M2_HOME environment variable and mvn script match.

 
可以设一个环境变量M2_HOME指向你的maven安装目录
M2_HOME=\Apps\apache-maven-3.3.1
选中项目-->右键----> build Path-----> configure build path-----> .........--------->Installed JREs->Edit

如下图所示:

Java compiler level does not match the version of the installed Java project facet.-Dmaven.multiModu_第4张图片

在Default VM arguments中设置
-Dmaven.multiModuleProjectDirectory=$M2_HOME

Java compiler level does not match the version of the installed Java project facet.-Dmaven.multiModu_第5张图片






你可能感兴趣的:(java,mac,compiler)