在使用eclipse过程中Maven构建项目过程中报错
No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
原因是eclipse的环境配置有问题,
windows-preferences-java-installed JREs中配置为jre
而maven的conf/settings.xml中配置为JDK
<profile>
<id>jdk-1.8</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.8</jdk>
</activation>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
</properties>
</profile>
因此产生冲突
解决方案:
将eclipse中installed-JREs内容替换为JDK

1,点击add

2.选择standard VM next>

3 JRE home 点击 directory 选择JDK目录
点击finish
apply and close
到此,环境配置更新完成,但是需要将已经建好的Maven项目修改下配置

项目右键 build path – configure build path
libraries标签下
选中JRE System Library , 点击edit

选择JDK
applyandclose
然后再compile

构建成功
本文详细解析了在Eclipse中使用Maven构建项目时遇到的Nocompilerisprovidedinthisenvironment错误原因及解决方案,涉及环境配置冲突、JRE与JDK设置调整,以及如何正确配置settings.xml文件。
728

被折叠的 条评论
为什么被折叠?



