在写代码的时候工程出现了这样奇怪的bug很是蛋疼啊,经过查询解决方法,终于解决了这些个问题。
下面是解决问题的方法,和大家分享一下
(1)确定你的java工程配置使用了java 7
右键单击你的工程project > Properties > Java Compiler and set “Compiler compliance level” to 1.7
(2)选择Java Build Path. 按照下图点击 “Edit“. 把JDK版本调到“Java 7″
(3)选择Project Facets > Java 将它的版本也设置为 1.7
(4)在确认完上面的步骤之后,再在你的pom.xml文件中添加下面的代码
<build>
<plugins>
<!-- define the project compile level -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
(5)之后就执行 Maven -> Update Project. 就可以了,你会惊奇的发现问题被解决了。
注:有问题不可怕,怕的是怯懦的心,怕的是失去战斗的勇气。出现一个问题解决一个,愚公尚能移山,我也一定能成为软件工程的顶尖人才。