I have a GWT game project. I'd like to pull some of the base classes out into a project that can be shared with all my other GWT game projects. Something like:
- FarmFrenzyFinale (gwt game project)
- AcesOverNewYork (gwt game project)
- mylib (shared project that the above two can import)
The project "mylib" would have some generic stuff in it like maybe a euclidean distance method, maybe some other methods which operate on GWT-specific classes, like adding a Label to a RootPanel.
After reading many posts on this subject, it seems that if we want "mylib" to be included in the GWT clientside code, we need to have specific package naming, and a projectname.gwt.xml file. Should look something like:
|- com.me.mylib
| |---- mylib.gwt.xml // not sure of the contents here
|
|- com.me.mylib.client
| |---- classes you want included clientside go here.
Is the above correct? If so, when creating the project in eclipse, do we just create a new "java project", or are we supposed to create a new "Web Application" project? A new "web app" project will create a standalone gwt project for us, so I'm guessing we can just do a plain old "java project" as long as we setup the structure above ok.
Then after the above is setup, we can add "mylib" to the classpath of the games (farm frenzy etc). This would be done simply as right clicking the project, properties -> java build path -> projects -> add ?
Thanks
-------- Update ---------------
This is what my project currently looks like:
AcesOverNewYork
|-- com.me.acesovernewyork
| |-- acesovernewyork.gwt.xml
|-- com.me.acesovernewyork.client
|-- all java files here, great.
mylib (not a gwt project, just a java project)
|-- com.me.mylib.client
|-- Foo.java
Now AcesOverNewYork (AONY) has "mylib" added as a project in the classpath (in eclipse, right-click AONY, Properties -> Java Build Path -> Projects -> Add -> "mylib".
I use the Foo class in AONY, compiles fine. When I try to run AONY, I get a runtime error:
"No source code is available for type com.me.mylib.client.Foo;
did you forget to inherit a required module?"
my acesovernewyork.gwt.xml file has the following in it:
<source path='client'/>
Hmm so what else am I missing here?
Thanks