Reputation: 900
So I have a regular Java project IRBenchmarker in Eclipse in which I've defined several classes, one of which is an enum edu.mit.ll.irbenchmark.EvaluationMetric. Now I'm writing a Google Web Toolkit Eclipse project IRBenchmarker-WebGUI and I want the client to pass an EvaluationMetric value as a parameter to a service on the server.
I've followed the instructions at Eclipse 3.4 GWT 1.6 project - how to reference source from other projects? but must be doing something wrong. Here's how I have things set up.
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
The file IRBenchmarker.gwt.xml contains:
<?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>
The file IRBenchmarker_WebGUI.gwt.xml contains:
<?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>
The Eclipse Java Build Path of IRBenchmarker-WebGUI contains the project IRBenchmarker.
When I attempt to run the project and bring up the page in a browser, I get
[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?
Note that above this error, under "Validate newly compiled units" there is
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.
What am I missing?
Update: So I'm proceeding by making a JAR file with source from IRBenchmarker, and including that in IRBenchmarker-WebGUI. Seems to work, though it is inconvenient to have to rebuild the jar every time I change code in IRBenchmarker.
Upvotes: 1
Views: 314
Reputation: 64541
You might have to explicitly add the src
folder of the other project in the Classpath tab of your DevMode launch configuration.
Upvotes: 1
Reputation: 4822
try putting
<inherits name="edu.mit.ll.irbenchmark.IRBenchmarker" />
in your IRBenchmarker.gwt.xml as well
I have an separate project in GWT that holds my model and i have that line in both GWT.xml files.
Also, make sure you have the root client and server packages that match the folder structure of your project match the exact same structure in your GWT project.
Upvotes: 0