【问题标题】:GWT 2.7.0 Compile fails [ERROR] Unable to find class java/lang/ObjectGWT 2.7.0 编译失败 [错误] 找不到类 java/lang/Object
【发布时间】:2017-01-05 03:38:14
【问题描述】:

我有一个在 2.6.1 中构建但在 2.7.0 中构建失败的项目。我已经在互联网上寻找一个好的答案,但我找不到。

这是 Maven 构建的输出:

...已删除无趣的东西

[INFO] Compiling module XXXX
[INFO]    Looking for precompiled archives.  To disable, use -Dgwt.usearchives=false
[INFO]    Loading archived module: jar:file:/C:/Users/3433/.m2/repository/com/google/gwt/gwt-user/2.7.0/gwt-user-2.7.0.jar!/com/google/gwt/core/Core.gwtar

...

[INFO]    Compiling...
[INFO]       Compilation completed in 5,95 seconds
[INFO]    Invalid Unit: com.google.gwt.validation.client.impl.BaseGwtConfiguration
[INFO]    Invalid Unit: com.google.gwt.validation.client.spi.GwtValidationProvider

...删除了其他无效单位

[INFO]    Invalid Unit: com.google.gwt.validation.client.spi.BaseConfigurationState
[INFO]    Invalid Unit: java.lang.String
[INFO]    Invalid units found: 11
[INFO]    Compiling...
[INFO]       Compilation completed in 0,04 seconds
[INFO]    Added 3762 units to cache since last cleanup.
[INFO]    Tracing compile failure path for type 'java.lang.String'
[INFO]       Errors in 'jar:file:/C:/Users/3433/.m2/repository/com/google/gwt/gwt-user/2.7.0/gwt-user-2.7.0.jar!/com/google/gwt/emul/java/lang/String.java'
[INFO]          Line 976: The method getDefault() is undefined for the type Locale
[INFO]    Removing invalidated units
[INFO] Wrote 3762 units to persistent cache.
[INFO]    Resolving java.util.Locale
[INFO]       Found type 'java.util.Locale'
[INFO]          [WARN] Unable to resolve supertype java/lang/Object

删除了许多错误...

[INFO]    Resolving com.google.gwt.core.client.AsyncProvider
[INFO]       Found type 'com.google.gwt.core.client.AsyncProvider'
[INFO]          [ERROR] Unable to find class java/lang/Object

[INFO]          Resolving method get
[INFO]             Found type 'com.google.gwt.core.client.Callback'
[INFO]                [ERROR] Unable to find class java/lang/Object

删除了数百个类似的错误

[INFO]    Tracing compile failure path for type 'java.lang.Object'
[INFO]       [ERROR] Errors in 'file:/usr/local/google/home/dankurka/gwt/user/super/com/google/gwt/emul/java/lang/Object.java'
[INFO]          [ERROR] java.lang.String cannot be resolved to a type

Dan Kurka 的主路径在我的构建中做了什么?

有什么想法吗?

【问题讨论】:

    标签: gwt-2.7


    【解决方案1】:

    我知道这是一篇旧帖子,但我最近遇到了同样的问题,所以我想我会发布我的发现。

    就我而言,我是从 GWT 2.5.1 迁移到 2.7.0。我们的代码中有一个 java.util.Locale 类,因此 GWT 编译器拥有仿真所需的所有源代码,并且它与 GWT 2.7.0 中同一类的结构不匹配。我不得不添加缺少的方法,然后就很好了。

    为了找到原因,我不得不使用 -Dgwt.logLevel=DEBUG 参数重新编译。没有那一套,我的问题的根本原因就被隐藏了。当我使用日志级别集进行编译时,我能够看到问题所在:

    [INFO]    Compiling...
    [INFO]       30% complete (ETR: 9 seconds)
    [INFO]       30% complete (ETR: 9 seconds)
    [INFO]       30% complete (ETR: 9 seconds)
    [INFO]       30% complete (ETR: 9 seconds)
    [INFO]       40% complete (ETR: 8 seconds)
    [INFO]       50% complete (ETR: 6 seconds)
    [INFO]       60% complete (ETR: 4 seconds)
    [INFO]       70% complete (ETR: 3 seconds)
    [INFO]       80% complete (ETR: 2 seconds)
    [INFO]       90% complete (ETR: 1 seconds)
    [INFO]       100% complete (ETR: 0 seconds)
    [INFO]       Compilation completed in 11.10 seconds
    [INFO]    java.util.Locale isn't structurally same.
    [INFO]    Invalid Unit: java.lang.String
    [INFO]    Invalid units found: 1
    [INFO]    Compiling...
    [INFO]       Compilation completed in 0.02 seconds
    [INFO]    Added 5097 units to cache since last cleanup.
    [INFO]    Tracing compile failure path for type 'java.lang.String'
    [INFO]       Errors in 'jar:file:/Users/randymay/.m2/repository/com/google/gwt/gwt-user/2.7.0/gwt-user-2.7.0.jar!/com/google/gwt/emul/java/lang/String.java'
    [INFO]          Line 991: The method getDefault() is undefined for the type Locale
    [INFO]          Line 976: The method getDefault() is undefined for the type Locale
    [INFO]       Checked 1 dependencies for errors.
    

    【讨论】:

    • @randymay 建议使用-Dgwt.logLevel=DEBUG 是一个非常好的建议,但是,对于 maven 插件/GWT 版本/等。我有,它是-DlogLevel=DEBUG。当真正的问题(由调试输出确定)是创建目标目录的问题。我怀疑 Unable to find type 'java.lang.Object' 错误更像是一个通用的 Something bad occurred® 消息,当进程进一步失败时显示。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-11-05
    • 1970-01-01
    相关资源
    最近更新 更多