【发布时间】:2021-05-16 07:32:25
【问题描述】:
很遗憾,无法为我的 Vaadin 应用程序执行 maven 安装。我在 Eclipse 中没有错误。也可以通过 Eclipse 运行应用程序。但是 maven 安装总是在这个错误中运行:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project lunchlist: Compilation failure: Compilation failure:
[ERROR] /C:/Users/thomas/workspace/test/src/main/java/TestView.java:[214,42] incompatible types: cannot infer type-variable(s) T
[ERROR] (argument mismatch; cannot infer functional interface descriptor for com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.component.ClickEvent>)
[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
以下代码导致编译错误:
ComponentUtil.addListener(label, ClickEvent.class, e -> {
xxxxx
});
有人有想法吗?提前致谢! :)
最好的问候, 托马斯
【问题讨论】:
-
您的 maven 命令是否使用与 eclipse 相同版本的 java 来编译应用程序的源代码?
-
您好!我不知道。如何识别/更改 Maven 的 Java 版本(在 Eclipse 中)?我在 Eclipse 中通过右键单击执行 maven 命令。问候,托马斯
-
我可以在 IntelliJ 中重现它,因为它在类中没有显示错误,但是运行、构建或
mvn install显示该错误。尝试使用 AdoptOpenJDK 11.0.11 和 1.8.0_265。通过mvn -version可以看到Maven使用的是哪个版本,应该是JAVA_HOME环境变量指向的版本。 -
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f) Java 版本:15.0.2,供应商:Oracle Corporation,运行时:C:\Program Files\Java\jdk-15.0.2 默认语言环境:de_DE,平台编码: UTF-8 操作系统名称:“windows 10”,版本:“10.0”,arch:“amd64”,family:“windows” 与在 Eclipse 中编译源代码的 java 版本相同
标签: vaadin vaadin-flow