views:

81

answers:

1

I'd like to create a GWT (2.0.4) project but with my source in a common java directory that's not kept under the GWT project directory.

I did the following:

1) Created new project 'game' in package com.mycomp.project.game. This worked fine, with its source under C:\java\Projects\game\src\com\mycomp\project\game.

2) Copied the code into C:\java\com\mycomp\project\game

3) Deleted the directories under C:\Projects\game\src\

4) File, New Folder, Advanced/Link to folder in filesystem to make a 'com' folder under src that links to C:\java\com.

This worked enough that I can see all the source under a com.mycomp.project.game folder in Eclipse, but when I try to run my project I now get errors of "Unable to find type 'com.mycomp.project.game.client.Game'".

Does GWT just not work with these links to filesystem folders? Is there any way for me to keep my Java code somewhere outside of my project directory but still have it work in GWT?

Thanks.

A: 

You have two options.

  • Move the source code into a directory under your GWT module (.gwt.xml file) location and change the <source path="" /> to point to the shared directory and the client code.
  • Create a JAR file with the source you want to reuse. The JAR will also have to have a GWT module. In your existing project you'll have to <inherit ... /> that reusable JAR.
Arthur Kalmenson
But can I keep that code in a separate directory from the rest of my project source? (I guess a better original question might've been: How do I make GWT modules that can be shared between different projects rather than have them all in one project?) My understanding is that without linked folders (on Windows), I need to have all of the GWT modules under a single project src directory. If I want to have ProjectFoo and ProjectBar both use SharedModule, can I have SharedModule under a directory separate from the two projects as long as I put the module XML file with it?
Mark Schmit