[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project news_search: Compilation failure: Compilation failure:
[ERROR] /y/ESClientSpringFactory.java:[71,63] -source 1.5 中不支持 lambda 表达式
[ERROR] (请使用 -source 8 或更高版本以启用 lambda 表达式)
[ERROR] /lasticsearchUtil.java:[180,27] -source 1.5 中不支持 lambda 表达式
[ERROR] (请使用 -source 8 或更高版本以启用 lambda 表达式)
[ERROR] lasticsearchUtil.java:[339,62] -source 1.5 中不支持 diamond 运算符
[ERROR] (请使用 -source 7 或更高版本以启用 diamond 运算符)
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :news_search
一看错误,明显是jdk的问题,但是我看了maven,看了jdk。感觉都没问题!
还是出错,看来问题还是比较棘手。
网上搜索了一波,找到了一个解决方案。
那就是《在maven的setting.xml中指定jdk版本》,(可以点击进去查看,也可以看下方操作)
打开maven所在的位置,打开conf下的setting.xml,如我的:D:\Path\apache-maven-3.5.4\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>
解决问题!!!