TurboManage

David Chandler's Journal of Java Web and Mobile Development

  • David M. Chandler


    Web app developer since 1994 and former Developer Advocate with Google now residing in Colorado. Besides tech, I enjoy landscape photography and share my work at ColoradoPhoto.gallery.

  • Subscribe

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 241 other followers

  • Sleepless Nights…

    March 2011
    S M T W T F S
    « Feb   Apr »
     12345
    6789101112
    13141516171819
    20212223242526
    2728293031  
  • Blog Stats

    • 865,600 hits

Working on GWT

Posted by David Chandler on March 18, 2011

Lately, I’ve been working on a GWT patch to enable server-side inheritance in RequestFactory services. Along the way, I’ve picked up a few tips about working on the GWT source itself and thought I’d share them with others who may be interested. (By the way, the Web-based code review tool at the patch link above is used by many teams at Google and is itself an open source project written by Guido vonRossum, creator of python. It runs on App Engine, and is a powerful tool for any open source project).

Check out the GWT source from SVN

> mkdir gwt
> cd gwt
> svn checkout https://google-web-toolkit.googlecode.com/svn/trunk/ trunk
> svn checkout https://google-web-toolkit.googlecode.com/svn/tools/ tools

Import the gwt-dev and gwt-user projects into Eclipse

In Eclipse, go to File | Import | Existing project and browse to gwt/trunk/eclipse. This will find many pre-built projects you can import. Check the boxes to import gwt-dev and gwt-user.

Configure Eclipse

  1. Go to Preferences | General > Workspace > Linked Resources and create a new resource named GWT_ROOT that points the trunk folder above.
  2. Go to Preferences | Java > Build path > Classpath variables and create a new variable named GWT_TOOLS that points to the tools folder above.

At this point, the gwt-dev and gwt-user projects in your workspace should build without errors. If you’re planning to contribute code to GWT, you’ll also want to import the GWT style formatter for Eclipse.

Run Tests

There are a couple gotchas to running the GWT unit tests in Eclipse. First, some tests seem to require more stack memory than the Eclipse defaults, so you’ll want to add the following parameter under the -vmargs in your eclipse.ini:

-Xss1024k

Second, any tests that extend GWTTestCase, whether directly or up the inheritance chain, must be run as GWT JUnit tests, not regular JUnit tests. Google Plugin for Eclipse automatically makes the “Run as GWT JUnit test” option available in the context menu for GWT projects, but gwt-user itself is not a GWT project. To run a test located in gwt-user as a GWT JUnit test, do the following:

  1. Right-click on the gwt-user project and go to Properties | Google | Web Toolkit. Check the box that says “Use Google Web Toolkit”. The version numbers will be grayed out, but that’s OK. Click OK.
  2. Right-click on the test you’re interested in, say, RequestFactoryJreTest, and select Run As | Run Configurations… In the dialog, click GWT JUnit Test and then the New icon in the upper left corner of the dialog. This will create a new launch config for the test. Click the Run button to run it.

For further reading, here are the detailed instructions on setting up Eclipse to work on GWT source. If you want to contribute a patch to GWT, please see the Making GWT Better page for further instructions.

Happy coding!

Advertisements

3 Responses to “Working on GWT”

  1. Pierre said

    Hi David,

    I have done this one time , and then remove the two gwt projects (gwt-user, gwt-dev) abd then retried. but when retrying, both were not listed inthe list of available projects.

    How to fix that ?
    Thanks

    • Do you have another project named gwt-user or gwt-dev? If so, rename them as Eclipse won’t let you import the same project name twice. Do you see the .classpath and .project files in the eclipse/user and eclipse/dev directories? If not, svn update from trunk and try again.

  2. Pierre said

    David,

    Yes, I suppressed both projects files, but couldnt see these projects in import dialog!
    So I updated and that solved the issue.

    Thanks

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: