具有依赖项目源的超级开发模式

SuperDevMode with dependent Project Source

本文关键字:开发 模式 依赖 项目      更新时间:2023-09-26

我有一个名为ProjectA的GWT项目,这是一个使用GWT eclipse插件生成的简单Web应用程序项目。

另外,我还有第二个项目(projectB),这是一个纯Java项目,具有以下结构

src/com/test/shared/TestClass.java
src/com/test/Shared.gwt.xml

Shared.gwt.xml像这样:

<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='shared'>
    <inherits name='com.google.gwt.user.User'/>
    <source path='shared'/>
</module>

TestClass.java 是:

public class TestClass {
  public static void start() {
    // do something    
  }
}

在项目A的gwt中.xml我包括了<inherits name="com.test.Shared" />。我在项目A的某种方法中使用TestClass.start()。然后,我将项目 B 包含在项目 A 中。因此,我右键单击项目A>属性>Java构建路径>项目并添加了项目B。我切换到Order and Export选项卡并激活了项目B上的复选标记。

目前为止,一切都好。当我在项目 A 上执行 GWT 编译时,我没有收到任何错误,但是当我在 SuperDevMode 中运行项目 A 时,编译器会打印以下错误:

GET /recompile/mobilePhoneGapIOS
   Job test.mobile.MobilePhoneGapIOS_1_4
      starting job: test.mobile.MobilePhoneGapIOS_1_4
      binding: mgwt.density=xhigh
      Compiling module test.mobile.MobilePhoneGapIOS
         Ignored 1 unit with compilation errors in first pass.
Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
         Computing all possible rebind results for 'com.gwtplatform.mvp.client.ApplicationController'
            Rebinding com.gwtplatform.mvp.client.ApplicationController
               Invoking generator com.gwtplatform.mvp.rebind.ApplicationControllerGenerator
                  [ERROR] The type 'test.mobile.client.BootstrapperImpl' was not found.
         [ERROR] Errors in 'gen/com/google/gwt/lang/test_00046mobile_00046MobilePhoneGapIOS__EntryMethodHolder.java'
            [ERROR] Line 3: Failed to resolve 'com.gwtplatform.mvp.client.ApplicationController' via deferred binding
         [WARN] For the following type(s), generated source was never committed (did you forget to call commit()?)
            [WARN] com.gwtplatform.mvp.client.ApplicationControllerImpl
         Unification traversed 597 fields and methods and 351 types. 2 are considered part of the current module and 22 had all of their fields and methods traversed.
         [WARN] Some stale types ([test.mobile.client.BootstrapperImpl$7, test.mobile.client.BootstrapperImpl$6, test.mobile.client.BootstrapperImpl$5, test.mobile.client.BootstrapperImpl$4, test.mobile.client.BootstrapperImpl$3, test.mobile.client.BootstrapperImpl$2$3, test.mobile.client.BootstrapperImpl, test.mobile.client.BootstrapperImpl$2$2, test.mobile.client.BootstrapperImpl$2, test.mobile.client.BootstrapperImpl$1, com.gwtplatform.dispatch.rest.client.serialization.com_gwtplatform_mvp_client_DesktopGinjector_DesktopGinjectorGinjector_fragment, test.mobile.client.BootstrapperImpl$9, test.mobile.client.BootstrapperImpl$8, com.gwtplatform.mvp.client.com_gwtplatform_mvp_client_DesktopGinjectorImpl, com.gwtplatform.mvp.client.DesktopGinjectorProvider, test.mobile.client.BootstrapperImpl$2$1, test.mobile.client.com_gwtplatform_mvp_client_DesktopGinjector_DesktopGinjectorGinjector_fragment, com.gwtplatform.mvp.client.ClientGinjector, test.mobile.client.BootstrapperImpl$10]) were not reprocessed as was expected. This is either a compiler bug or a Generator has legitimately stopped creating these types.
      [ERROR] Compiler returned false
      [WARN] recompile failed
      [WARN] continuing to serve previous version 

错误没有显示TestClass类,但是当我注释掉它(不使用TestClass.start())时,它在SDM中编译没有问题。

我知道我可以预编译项目 B 并将源代码作为 jar lib 包含在项目 A 中,但我希望能够一直修改项目 B 的代码。

如何在使用链接的项目 B 时让超级开发模式工作?

生成器可能需要在路径中编译.class文件。因此,请尝试将 bin/(或 Eclipse 调用的任何内容)文件夹包含在类路径中