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?

可能由于以下几种情况导致:

1. 开发工具没有指定jdk。设置jdk:

eclipse:No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?_第1张图片

idea:File->setting->project 

No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?_第2张图片

 

设置完成后:clean下,重新执行即可;

2. 由于maven默认版本(自己没有显示的指定项目编译的jdk版本)和本地的jdk版本不兼容导致;

在项目下的pom.xml加上(手动指定jdk的版本):
 


				maven-compiler-plugin
				
					1.8
					1.8
					true
				
			

3. 当然如果由于2中的原因引起的话,同样可以在maven的conf/setting.xml下配置jdk编译版本:

	     
		jdk   
		        
          true    
          1.8      
		  
		  
          1.8 
          1.8 
          1.8   
		  utf-8 
		
	

祝君好运了....

你可能感兴趣的:(maven)