The Google Web Toolkit distribution comes with very handy tools for seeding new projects. The drawback of this utility is that produced project stub will reference local GWT distribution directory. In case of homogenous development environment like every developer using windows machine, some common convention of keeping GWT distribution on
C:\gwt-windows-x.y.z could be introduced. There is still problem when new GWT is released, because path to GWT home is hardcoded in project configuration.
I want to propose a solution based on some eclipse configuration, which will not only ease GWT upgrades, but also allows developers working on different operating systems to share GWT projects. Here is a quick how to:
In eclipse preferences add
Classpath Variable named
GWT_HOME, and point it to your GWT distribution directory.
Run GWT project creation scripts as usual:
$ projectCreator -eclipse foo-project $ applicationCreator -eclipse foo-project org.foo.client.FooApp
.classpath and replace:
<classpathentry kind="lib" path="/foo/bar/gwt-mac-x.y.z/gwt-user.jar"/>
<classpathentry kind="var" path="GWT_HOME/gwt-user.jar"/>
Now in eclipse:
Open Run Dialog
- go to
User Entriesremove reference to
Add Classpath Variables
FooApp launch configuration should work now. However as you can see it is still platform dependent. To overcome this just duplicate
FooApp Java Application twice in Run Dialog, every time renaming it according to destination platform. It should be something like:
Each of above launch configurations should
have GWT_HOME/gwt-dev-platform.jar in
User Entries where platform should be set according to launch configuration suffix.
That's all. You can share the project in your source code repository and enjoy abstract configuration which is not limited to your environment.
Just remember to add
-XstartOnFirstThread VM argument in case of mac launch configuration.
To add your post: Sometimes it might be useful also to change fully qualified path in YourProjectName-shell.cmd, YourProjectName-compile.cmd to gwt-dev.jar and gwt-user.jar with %GWT_HOME%/gwt-dev.jar and %GWT_HOME%/gwt-user.jar to increase portability (and share-ability) of the projectReplyDelete