Total Pageviews

Thursday, October 16, 2008

Problem solved: Eclipse with Cypal Studio, m2eclipse running GWT Hosted Mode under Linux

I am developing a GWT application on my laptop which runs on Ubuntu 8.
I am using Eclipse 3.4 with the m2eclipse plugin (my project is built using Maven 2) and Cypal Studio as GWT plugin. So far, nothing fancy one should think.
But there are a few things to overcome with:
  1. When you import your Maven project using m2eclipse the web project containing the GWT code will not be configured correctly to work with Cypal Studio. I haven't figured out yet the reason why, but a workaround to this problem is to generate the eclipse project files for the web project by executing "mvn eclipse:eclipse" manually. Now you are able to add a working "Run configuration" for the GWT hosted mode in eclipse.
  2. I started the newly created "Run Configuration" and got an error message stating that a file called "libswt-pi-gtk-3235.so" was missing. So I copied that one from the installed GWT 1.5.2 distribution to my local maven repository into the directory $M2_REPOSITORY/com/google/gwt/gwt-dev/VERSION.
  3. Now, choosing "Run" one would expect to see a starting hosted mode browser (namely Mozilla Firefox). But the only thing I saw was an error message saying "** Unable to find a usable Mozilla install **". Hm, I had installed the latest GWT distribution (1.5.2) and I had configured the path correctly within the Cypal preferences. The dependencies for the web project were all correctly managed by m2eclipse. So what the hell was going wrong?
    Well it turns out to be a problem with the gwt-dev-1.5.2-linux.jar dependency and the way Cypal (or GWT) resolves dependencies.
    The gwt-dev-1.5.2-linux.jar was a dependency of my web project. So Cypal (or GWT) assumes to have a valid GWT distribution and therefore a runnable Mozilla Firefox installed in the directory $M2_REPOSITORY/com/google/gwt/gwt-dev/VERSION. That was obviously not the case.
    So I copied ALL *.so files and the file mozilla-hosted-browser.conf from the GWT distribution directory to the $M2_REPOSITORY/com/google/gwt/gwt-dev/VERSION folder.
  4. The last thing was to edit the mozilla-hosted-browser.conf file and point to the mozilla-firefox installation of the GWT distribution. I did this using absolut path arguments (eg. /usr/local/share/gwt/gwt-1.5.2/mozilla-1.7.12).
  5. Now Cypal starts the GWT Hosted mode with the Mozilla Firefox browser.
I am aware of the fact that this is not the best solution. Poluting the maven directory with shared object files of the GWT distribution is somehow weird. But so far this is the only working scenario I have successfully configured and running with.
If you have a better solution don't hesitate to comment on this entry.