首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >GWT在其他项目中找不到用户定义的类

GWT在其他项目中找不到用户定义的类
EN

Stack Overflow用户
提问于 2012-10-26 23:12:23
回答 2查看 305关注 0票数 1

因此,我在Eclipse中有一个常规的Java项目IRBenchmarker,我在其中定义了几个类,其中一个是枚举edu.mit.ll.irbenchmark.EvaluationMetric。现在,我正在编写一个Google Web Toolkit Eclipse项目IRBenchmarker WebGUI,我希望客户端将一个EvaluationMetric值作为参数传递给服务器上的服务。

我遵循了Eclipse 3.4 GWT 1.6 project - how to reference source from other projects?上的说明,但一定是做错了什么。下面是我的设置。

代码语言:javascript
复制
workspace
-- IRBenchmarker-WebGUI
   -- src
      -- edu.mit.ll.irbenchmark
         -- IRBenchmarker_WebGUI.gwt.xml
-- IRBenchmarker
   -- src
      -- edu.mit.ll.irbenchmark
         -- IRBenchmarker.gwt.xml
      -- edu.mit.ll.irbenchmark.client
         -- EvaluationMetric.java

文件IRBenchmarker.gwt.xml包含:

代码语言:javascript
复制
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 1.7.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/1.7.0/distro-source/core/src/gwt-module.dtd">
<!--  Expose classes useful to the web client as a Google Web Toolkit module -->
<module rename-to='IRBenchmarker'>
    <inherits name='com.google.gwt.user.User' />
    <source path="client" />
</module>

文件IRBenchmarker_WebGUI.gwt.xml包含:

代码语言:javascript
复制
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='irbenchmarker_webgui'>
  <!-- Inherit the core Web Toolkit stuff.                        -->
  <inherits name='com.google.gwt.user.User'/>

  <!-- Inherit the default GWT style sheet.  You can change       -->
  <!-- the theme of your GWT application by uncommenting          -->
  <!-- any one of the following lines.                            -->
  <inherits name='com.google.gwt.user.theme.clean.Clean'/>
  <!-- <inherits name='com.google.gwt.user.theme.standard.Standard'/> -->
  <!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
  <!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/>     -->

  <!-- Other module inherits                                      -->
  <inherits name="edu.mit.ll.irbenchmark.IRBenchmarker" />

  <!-- Specify the app entry point class.                         -->
  <entry-point class='edu.mit.ll.irbenchmark.client.IRBenchmarker_WebGUI'/>

  <!-- Specify the paths for translatable code                    -->
  <source path='client'/>
  <source path='shared'/>

</module>

IRBenchmarker WebGUI的Eclipse Java构建路径包含项目IRBenchmarker。

当我尝试运行项目并在浏览器中打开页面时,我得到

代码语言:javascript
复制
[ERROR] [irbenchmarker_webgui] - Line 124: No source code is available for type edu.mit.ll.irbenchmark.client.EvaluationMetric; did you forget to inherit a required module?

请注意,在此错误之上,在“验证新编译的单元”下有

代码语言:javascript
复制
10:57:15.767 [INFO] [irbenchmarker_webgui] Ignored 3 units with compilation errors in first pass.
Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.

我遗漏了什么?

更新:因此,我将使用来自IRBenchmarker的源代码创建一个JAR文件,并将其包含在IRBenchmarker中。似乎可以工作,尽管每次在IRBenchmarker中更改代码时都必须重新构建jar是不方便的。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2012-10-27 02:34:06

您可能需要在DevMode启动配置的Classpath选项卡中显式添加另一个项目的src文件夹。

票数 1
EN

Stack Overflow用户

发布于 2012-10-27 02:05:39

试着把

代码语言:javascript
复制
<inherits name="edu.mit.ll.irbenchmark.IRBenchmarker" />

在你的IRBenchmarker.gwt.xml中也是如此

我在GWT中有一个单独的项目来保存我的模型,我在两个GWT.xml文件中都有这一行。

此外,确保与项目的文件夹结构相匹配的根客户端和服务器包与GWT项目中的完全相同的结构相匹配。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13089586

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档