首先需要下载插件:"Help" --> "Market Place" --> Search for java 8 kepler.
- install Java 8 support eclipse kepler sr2,
- Java 8 Facets for web tools eclipse kepler sr2
- Java 8 support for m2e for Eclipse Kepler SR2 (if required)
然后在pom.xml文件中配置:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
选中工程,右键"Maven" --> "Update Project..."。如果不是Maven工程,需要先转化成Maven工程。