當我嘗試使用 Eclipse IDE 在 Tomcat 服務器上編譯本地專案時遇到問題。我使用的是 GWT 2.7.0,我的 java 版本是 1.8.301。當我在本地使用命令列編譯時,它構建成功,但是當我嘗試使用 eclipse 編譯時,它會產生以下錯誤。非常感謝您的幫助,如果我不清楚我的問題是什么,我深表歉意。
[ERROR] Errors in 'jar:file:/C:/Users/11033178/.m2/repository/de/knightsoft-net/gwt-commons-lang3/3.12.0-3/gwt-commons-lang3-3.12.0-3.jar!/org/apache/commons/lang3/ObjectUtils.java'
[ERROR] Line 1343: Method references are allowed only at source level 1.8 or above
[ERROR] Hint: Your source appears not to live underneath a subpackage called 'client'; no problem, but you'll need to use the <source> directive in your module to make it accessible
Tracing compile failure path for type 'org.apache.commons.lang3.ArrayUtils'
[ERROR] Errors in 'jar:file:/C:/Users/11033178/.m2/repository/de/knightsoft-net/gwt-commons-lang3/3.12.0-3/gwt-commons-lang3-3.12.0-3.jar!/org/apache/commons/lang3/ArrayUtils.java'
[ERROR] Line 3794: Method references are allowed only at source level 1.8 or above
[ERROR] Hint: Your source appears not to live underneath a subpackage called 'client'; no problem, but you'll need to use the <source> directive in your module to make it accessible
Tracing compile failure path for type 'org.apache.commons.lang3.StringUtils'
[ERROR] Errors in 'jar:file:/C:/Users/11033178/.m2/repository/de/knightsoft-net/gwt-commons-lang3/3.12.0-3/gwt-commons-lang3-3.12.0-3.jar!/org/apache/commons/lang3/StringUtils.java'
[ERROR] Line 1214: Method references are allowed only at source level 1.8 or above
[ERROR] Line 2001: The method getBytes(String) in the type String is not applicable for the arguments (Charset)
[ERROR] Line 1152: Method references are allowed only at source level 1.8 or above
[ERROR] Hint: Your source appears not to live underneath a subpackage called 'client'; no problem, but you'll need to use the <source> directive in your module to make it accessible
Tracing compile failure path for type 'org.apache.commons.lang3.Validate'
[ERROR] Errors in 'jar:file:/C:/Users/11033178/.m2/repository/de/knightsoft-net/gwt-commons-lang3/3.12.0-3/gwt-commons-lang3-3.12.0-3.jar!/org/apache/commons/lang3/Validate.java'
[ERROR] Line 390: The method requireNonNull(T, String) in the type Objects is not applicable for the arguments (T, () -> {})
[ERROR] Line 343: Lambda expressions are allowed only at source level 1.8 or above
[ERROR] Line 249: The method requireNonNull(T, String) in the type Objects is not applicable for the arguments (T[], () -> {})
[ERROR] Line 249: Lambda expressions are allowed only at source level 1.8 or above
[ERROR] Line 296: The method requireNonNull(T, String) in the type Objects is not applicable for the arguments (T, () -> {})
[ERROR]**strong text** Line 441: Lambda expressions are allowed only at source level 1.8 or above
[ERROR] Line 226: Lambda expressions are allowed only at source level 1.8 or above
[ERROR] Line 390: Lambda expressions are allowed only at source level 1.8 or above
[ERROR] Line 226: The method requireNonNull(T, String) in the type Objects is not applicable for the arguments (T, () -> {})
[ERROR] Line 296: Lambda expressions are allowed only at source level 1.8 or above
[ERROR] Line 343: The method requireNonNull(T, String) in the type Objects is not applicable for the arguments (T, () -> {})
[ERROR] Line 441: The method requireNonNull(T, String) in the type Objects is not applicable for the arguments (T, () -> {})
[ERROR] Hint: Your source appears not to live underneath a subpackage called 'client'; no problem, but you'll need to use the <source> directive in your module to make it accessible
Unification traversed 50904 fields and methods and 4978 types. 4934 are considered part of the current module and 4934 had all of their fields and methods traversed.
[ERROR] Compiler returned false
[WARN] recompile failed
[WARN] continuing to serve previous version
uj5u.com熱心網友回復:
此錯誤訊息是您問題的線索:
[ERROR] Line 1343: Method references are allowed only at source level 1.8 or above
您的 Eclipse 專案似乎配置為早于 java 8 (1.8) 的 JDK 版本,并且您正在使用需要版本 8 的方法參考語言功能。
uj5u.com熱心網友回復:
您使用的是 GWT 2.7,它不支持 Java 8 語法(您至少需要 GWT 2.8,最新的是 2.9.0),但是您正在使用諸如 gwt-commons-lang3 版本 3.12.0-3 之類的庫,它使用Java 8 語法(可能還有庫)。
要么降級您??正在使用的庫,要么升級到可以處理 Java 8 語法(和庫)的更新版本的 GWT。
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/342424.html
上一篇:加載共享物件的兩個實體的安全方法
