解決方法:
1.在maven配置文件pom.xml中添加
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>2.1</version>
- <configuration>
- <source>1.6</source>
- <target>1.6</target>
- </configuration>
- </plugin>
2.同時爲了穩定起見修改eclipse配置window->preferences->Java->Compiler中的Compiler compliance level修改爲1.6或以上(目前1.6是最高版本)
3.相信在eclipse中使用maven的人都裝了m2eclipse插件,在項目上右擊選擇maven-> Update Project Configuration。
問題到此解決。