问题描述
我有一个 GWT 项目.客户端代码位于客户端"目录中.我想附加一个外部目录中的外部 java 类(主要是普通的 POJO DTO 类).如何配置gwt.xml文件?
I have a GWT project. Client code is located in the "client" dir. I want to attach an external java classes (mainly plain POJO DTO classes) that are in external directory. How to configure the gwt.xml file?
我收到此类错误:
[错误] 'file:/C:/development/projects/CodeSpaces/LocateMe/LocateMeWeb/src/com/dominolog/locateme/client/LocateMeWeb.java' 中的错误[错误] 第 56 行:没有可用于类型 com.dominolog.locateme.model.dto.LocationInfo 的源代码;您是否忘记继承所需的模块?
[ERROR] Errors in 'file:/C:/development/projects/CodeSpaces/LocateMe/LocateMeWeb/src/com/dominolog/locateme/client/LocateMeWeb.java' [ERROR] Line 56: No source code is available for type com.dominolog.locateme.model.dto.LocationInfo; did you forget to inherit a required module?
推荐答案
如果您有 java 源文件,您只需要将目录添加到您的 .gwt.xml 文件中.例如,如果您有一个名为 shared 的子目录,您将添加以下行:
If you have the java source files you just need to add the directory to you .gwt.xml file. For instance if you had a subdirectory called shared you would add the following line:
<source path='shared'/>
名为 shared 的文件夹必须位于主包下的一级.因此,如果您的项目 .gwt.xml 文件位于 com.yourdomain.project,则共享 folder.package 将是 com.yourdomain.project.shared.请参阅http://上的源路径部分/code.google.com/webtoolkit/doc/latest/DevGuideOrganizingProjects.html#DevGuideModules
The folder called shared would have to be one level under your main package. So if you project .gwt.xml file is at com.yourdomain.project the shared folder.package would be com.yourdomain.project.shared. Refer to the Source Path section at http://code.google.com/webtoolkit/doc/latest/DevGuideOrganizingProjects.html#DevGuideModules
如果您没有源代码并且只有类,您必须按照 Hilbrand 所述导入模块.
If you dont have the source and only have the classes you have to import a module as Hilbrand has stated.
这篇关于GWT - 将外部 java 类添加到客户端项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!