2012-10-26 11 views
1

因此,我在Eclipse中定義了一個常規的Java項目IRBenchmarker,其中我定義了幾個類,其中一個是enum edu.mit.ll.irbenchmark.EvaluationMetric。現在我正在編寫Google Web Toolkit Eclipse項目IRBenchmarker-WebGUI,並且我希望客戶端將EvaluationMetric值作爲參數傳遞給服務器上的服務。GWT未能在其他項目中找到用戶定義的類

我按照Eclipse 3.4 GWT 1.6 project - how to reference source from other projects?的說明操作,但一定是做錯了。以下是我設置事物的方式。

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包含:

<?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包含:

<?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> 

Eclipse的Java構建IRBenchmarker-的WebGUI的路徑中包含項目IRBenchmarker。

當我嘗試運行該項目,並打開該頁面在瀏覽器中,我得到

[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? 

注意,這個錯誤上面,在「驗證新編譯單位」有

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-WebGUI中。似乎可行,儘管每次更改IRBenchmarker中的代碼時都不得不重新構建jar。

回答

1

您可能需要顯式地添加其他項目的src文件夾中DevMode的啓動配置的類路徑標籤。

0

嘗試把

<inherits name="edu.mit.ll.irbenchmark.IRBenchmarker" /> 

在IRBenchmarker.gwt.xml以及

我在GWT的單獨項目,抓住我的模型,我有兩個GWT.xml文件一致。

此外,請確保您的根客戶端和服務器軟件包與您的項目的文件夾結構相匹配的GWT項目完全相同的結構。

相關問題