GWT:如何使用来自单独模块的bean?

GWT : How to use beans from separate module?

我正在开发一个包含独立模块的项目。 后端 管理员客户端 用户core 用于在 backendclient 之间共享 DAO 层。
backend 模块使用 GWT,client 使用 Spring MVC。在 backend 模块,core 模块被包含在 deployment assembly. My server side , DAOs are injected by Spring.
All beans(POJOs) created in core module. My problem is I would like to use these beans from core module in my gwt project (backend module) or when using RPC calls.
I tried as answers of How can share bean from external library to GWT client? 问题中,但还没有满足。我遇到以下错误

No source code is available for type com.mycom.core.business.bean.TestBean; [ERROR] Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly

这是我努力的代码...

TestBean.java

public class TestBean {
private int id;

public final int getId() {
    return id;
}

public final void setId(int id) {
    this.id = id;
}
}

beans.gwt.xml

<?xml version="1.0" encoding="UTF-8"?>
<module>
   <inherits name='com.google.gwt.user.User'/>
   <source path="com.mycom.core.business.bean.TestBean"/>
</module>

继承我的App.gwt.xml中的beans.gwt.xml为<inherits name='com.mycom.backend.beans'/>。我错过了什么?

Edit: Add sample project file

现在我创建并上传了示例模块。您可以从 google-drive URL 下载它。此存档文件包含 backendcore 模块。

最后,我使用 GWT-Eclipse 插件 构建并 运行,您可以查看

的屏幕截图

类路径

源查找路径

模块

以下是我的控制台中的错误日志

Super Dev Mode starting up
workDir: /var/folders/mt/5287l4j94jd9rfqwqdqxr9zw0000gq/T/gwt-codeserver-7296341534601698800.tmp
Loading Java files in com.mycom.backend.App.
Ignored 1 unit with compilation errors in first pass.
Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
Finding entry point classes
  Tracing compile failure path for type 'com.mycom.backend.client.Backend'
     [ERROR] Errors in 'file:/Applications/springsource/workspace/backend/src/com/mycom/backend/client/Backend.java'
        [ERROR] Line 41: No source code is available for type com.mycom.core.business.bean.TestBean; did you forget to inherit a required module?
  [ERROR] Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly
[WARN] Server class 'com.google.gwt.dev.shell.jetty.JDBCUnloader' could not be found in the web app, but was found on the system classpath
[WARN] Adding classpath entry 'file:/Users/cataclysm/Desktop/eclipse%20(Luna)/Datas/gwt-2.7.0/gwt-dev.jar' to the web app classpath for this session
For additional info see: file:/Users/cataclysm/Desktop/eclipse%20(Luna)/Datas/gwt-2.7.0/doc/helpInfo/webAppClassPath.html

GWT 编译过程应该可以访问核心模块的源路径。确保将其添加到类路径或源查找路径中。

beans 的模块文件应该在 core folder/library 中。 尝试将其移动到 core/src/com/mycom/ 并在 beans.gwt.xml:

中相应地修改源路径
<source path="core"/>

记住,是相对于模块文件的。

然后修改App.gwt.xml中的条目:

<inherits name='com.mycom.beans'/>

我不熟悉部署程序集,但请确保 beans.gwt.xml 存在于生成的库 jar 中(或与源代码一起复制)。