我在Eclipse中打开了maven项目。但是当我清理并安装时,我会遇到错误。
我将构建路径更改为使用SE 1.8,我的编译器也配置为使用1.8。您可以在以下屏幕截图中看到。
我在项目浏览器中也看到了很少的红色十字架。您可以在下面的图片中看到。
当我将Eclipse配置为在Eclipse中使用1.8时,我不确定为什么maven正在使用SE 1.7。
答案 0 :(得分:19)
编译时需要配置maven以使用1.8兼容性:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<encoding>utf8</encoding>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>