No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
对maven项目执行一些操作时,如maven clean/maven test/maven install等
出现异常:No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
可能由于以下几种情况导致:
- 开发工具没有指定jdk。设置jdk:
eclipse:
idea:File->setting->project
设置完成后:clean下,重新执行即可;
- 由于maven默认版本(自己没有显示的指定项目编译的jdk版本)和本地的jdk版本不兼容导致;
在项目下的pom.xml加上(手动指定jdk的版本):
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<fork>true</fork>
</configuration>
</plugin>
当然如果由于2中的原因引起的话,同样可以在maven的conf/setting.xml下配置jdk编译版本:
jdk
true
1.8
1.8
1.8
1.8
utf-8
祝君好运了….
还没有评论,来说两句吧...