背景:jdk1.8 maven3.2.5 Eclipse4.6.3
解决办法:
方法一,更改maven下的conf/setting.xml文件,添加一段,也就是注释的一段
<profile>
<id>jdk-1.8</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.8</jdk>
</activation>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
</properties>
</profile>
然后Update Project
方法二,给每个项目的pom.xml文件都加入下面一段
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
然后Update Project
至此结束,如果问题没有解决,请百度 :)