搜索了一番,解决办法都是这pom.xml中指定compiler的版本,如下:
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.2</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> </plugins> </build>
还有简洁版本:
实测下面这个好像不行! <properties> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> </properties>
至于原因,则是maven compiler plugin自身问题:
Apache Maven Co