operator is not allowed for source level below 1.7的正确解法

一、问题描述

该问题出现于Maven项目中。

二、问题示意图

operator is not allowed for source level below 1.7的正确解法_第1张图片

三、问题解决思路

该问题是jdk的版本低于1.7造成的,因此解决思路为将项目的java环境配置为1.7版本或以上。

四、问题解决方案

1.打开pom.xml文件,添加配置jdk插件(这里版本我指定的是1.8)


  	
	    
	        maven-compiler-plugin
	        3.1
	        
	          
	          1.8
	          1.8
	        
	    
  	

2.更新Maven项目:右键项目-->Maven-->Update Project...

operator is not allowed for source level below 1.7的正确解法_第2张图片

3.到此,问题已经解决,如果问题还没有解决,点击上方Windows-->Preferences

operator is not allowed for source level below 1.7的正确解法_第3张图片

4.选择Java-->Compiler,修改Compiler compliance level为1.7或以上的版本(我是1.8)

operator is not allowed for source level below 1.7的正确解法_第4张图片

5.至此,问题解决,如果还未解决,请下方评论留言说明错误之处,以交流讨论

你可能感兴趣的:(maven,java,tomcat)