1.之前,一直遇到这个问题。
Update Maven Project的时候,JDK变成了1.5的。
如果项目中有使用“@overdide”,程序就会报错,需要手动修改JRE为1.7的。
2. Maven打包时,Java代码使用了JDK1.7的语法" catch (IllegalArgumentException | IllegalAccessException e) "就报错。
这2个问题应该都是Maven的配置问题,JDK版本为1.5。
解决办法:修改Mavan的settings.xml
<profiles>
<profile>
<id>jdk-1.7</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.7</jdk>
</activation>
<properties>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<maven.compiler.compilerVersion>1.7</maven.compiler.compilerVersion>
</properties>
</profile>
</profiles>
增加上述配置就可以了。
参考资料:http://jingyan.baidu.com/article/84b4f565efc39e60f7da326b.html