编程语言
首页 > 编程语言> > java – Maven Tycho编译失败

java – Maven Tycho编译失败

作者:互联网

我正在使用maven和tycho插件来构建一个eclipse RCP应用程序.我使用了一些像lambda表达式这样的java 8特性,但由于编译失败,它无法正确构建.

[ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:1.0.0:compile (default-compile) on project ***.***: Compilation failure: Compilation failure:      
[ERROR]     .filter(Objects::nonNull)
[ERROR]             ^^^^^^^^^^^^^^^^
[ERROR] Method references are allowed only at source level 1.8 or above
[ERROR] 2 problems (2 errors)
[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

我的问题是:

>你认为文件.settings / org.eclipse.jdt.core.prefs和.classpath(我猜不是这个)是构建maven tycho所必需的吗?我是否必须在这些文件中明确定义java 8?
>我是否必须在pom文件中指定其他内容?

解决方法:

the tycho-compiler-plugin documentation中所述,文件.settings / org.eclipse.jdt.core.prefs中的信息将传递给编译器.

然后有必要更新文件如下:

org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.source=1.8

标签:tycho,java,maven,eclipse-plugin,eclipse-rcp
来源: https://codeday.me/bug/20190828/1747108.html