Top Ten Reasons to use Google Plugin for Eclipse

Posted by David Chandler - Tuesday, March 29, 2011 at 12:09:00 PM

As I speak at JUGs and conferences around the world, I'm often surprised that some folks have never seen some of the best features of Google Plugin for Eclipse, such as using the Eclipse debugger with a GWT app. So in no particular order, here are 10 reasons you should use Google Plugin for Eclipse (GPE).

  1. GWT+GAE made easy. GPE is the easiest way to get started with GWT and Google App Engine (GAE). Just check the SDKs box when you install the plugin through the Eclipse update site. It's easy to upgrade the SDKs this way (Help | Check for updates), and a status bar message in Eclipse will remind you when new versions are available.
  2. Wizards. It's easy to create your first GWT+GAE project. Click File | New | Web application project and you'll get a sample app that you can run locally to kick the tires and then deploy to Google App Engine. Beyond creating a new project, there are wizards to create new UiBinder templates, ClientBundles, GWT modules, and entry points. To use the wizards, click File | New and look for the items with the GWT toolbox logo (or click File | New | Other... and browse to the Google Web Toolkit folder).
  3. GWT Designer, now bundled with GPE, lets you quickly create a GUI. To see it in action, create a class that extends GWT's Composite class, then right-click on the file and Open With | GWT Designer. When the editor opens, click on the Design tab at the bottom. After GWT Designer launches, click a tool on the palette (say, LayoutPanel), then click on the empty design window to drop the widget in place. Click the source tab to see the code that GWT Designer wrote for you. It's a great way to learn the new cell widgets like CellTable and TextColumn, and GWT Designer has a built-in WYSIWYG CSS editor, too.
  4. Quick fixes and warnings help you write good GWT code quickly. For example, when you create an interface that extends GWT's RemoteService class, GPE will prompt you to create the corresponding async interface required for GWT-RPC. Just click Ctrl+1 (Quick Fix) on the red squiggly and away you go.
  5. Dev mode integration lets you test your code quickly. Run As | Web Application starts GWT development mode and the App Engine dev server (if applicable) so you can test your code in the browser. When dev mode starts, look for the Development Mode tab in Eclipse and double-click the URL to launch your app in the default browser. With GWT dev mode running, you can make changes to your Java code, hit Refresh in the browser, and see your changes live.
  6. Debugging in dev mode rocks. Set a breakpoint in Eclipse, right-click on your project, and Debug As | Web Application. Switch to the browser and run your code. Eclipse will open the Debug perspective where you can step through your code line-by-line, inspect variables, etc.
  7. One-click deploy to Google App Engine. Just click the Google App Engine logo on the toolbar.
  8. Maven support. GPE works with Maven projects via m2eclipse (see setup instructions). Check out a Maven project like the Expenses GWT+GAE sample app into your workspace, then click File | Import | Existing maven project and point it to the pom.xml file. Maven will download all the jars and plugins required in the POM, and GPE will configure the project with the GWT and/or App Engine SDKs from the POM. You can then run Maven commands externally or Run As | Web Application in Eclipse.
  9. Testing. Run As | GWT JUnit Test lets you easily run test cases that extend GWTTestCase.
  10. SpeedTracer. You can launch SpeedTracer from within Eclipse. Click the green stopwatch icon on the GPE toolbar. GPE will compile your app, run it, and launch SpeedTracer in Chrome to profile your app.
Haven't tried it yet? Install Google Plugin for Eclipse now.

7 comments:

Rihards said...

eclipse?? why people are using it....seriously?
meh i will stick with intellij idea

uga said...

Re: 7. One-click deploy

It is very common to use a lot of anonymous classes (click handlers, async callbacks) in GWT code, which results in a lot of *.class files in WEB-INF/classes. Because the plugin doesn't package application class files into a JAR file our application reached the file count limit (http://code.google.com/p/googleappengine/issues/detail?id=161) pretty quickly, even after it was increased to 3000.

So we're still using Ant for building and command line for deployment.

David Chandler said...

@uga, I've had success with maven-jar-plugin to remove GWT client classes and create a single jar for deployment to GAE. See http://code.google.com/p/listwidget/source/browse/trunk/pom.xml lines 297 and following.

uga said...

@David Chandler, thanks for the tip. We already solved the problem with a manual Ant script. It would be nice to be able to use the GPE though.

Philippe said...

My favorite feature from the GPE is not in there! :)

GWT often relies on code generators that need you to follow some naming or typing rules across two java files or between a java and an XML file. For example, when using UiBinder, the ui:fields in the .ui.xml must match the names of the @UiFields in your java class.

Such rules are not enforced by the Java compiler, but if you use the GEP you'll get a nice error telling you there is a typo in your field name.

It's not everywhere yet (RequestFactories could use some help from the GPE), but it definitely saved me a lot of test/rewrite cycles with UiBinder!

George Moschovitis said...

How about adding Maven-enabled versions of the GWT/GAE wizards?

Jim Ramia said...

Been using it - great experience for me.