I was disappointed to notice that the only good article out there about GWT + IDEA 7 has gone missing. Let me give it a quick stab:
Prerequisites
Make sure to set up Google Web Toolkit.
It may also help to add a path variable in IDEA to point to the installation of Google Web Toolkit.
Step 1: Create Project
- Open File, New Project.
- Select “Create project from scratch”. Set up a module and a source directory, like you usually would for a Java project.
- On the next screen of the wizard, check off “Google Web Toolkit”.
- Confirm and create the project.
Step 2: Create GWT module
- Create package
com.yourcompany.gwt.helloworldin the source directory. - Right-click your package, select New, Google Web Toolkit, GWT module.
- Name your module HelloWorld and notice how IDEA creates scaffolding code.
- Navigate to your module settings. (Ctrl+Alt+S, 1, “Module” in the list on the left)
- Select the GWT facet under the list of facets for your module. (from the tree in the center of the dialog)
- In “Path to GWT installation directory”, point to the directory where you extracted GWT.
Step 3: Add a Run target
- Open the Run dialog.
- Click on the plus sign to add a new configuration.
- Select Google Web Toolkit.
- In “Html to open”, enter the path to HelloWorld.html.
- Test the application.
Step 4: Add functionality to the GWT module
- Edit the entry point of the module, the
HelloWorldclass, located in thecom.yourcompany.gwt.helloworld.clientpackage. -
In
onModuleLoad, enter:Label label = new Label("Hello, world!"); RootPanel.get().add(label);
Step 5: Create web application
The purpose of this step is to enable communication of your GWT application with servlets that must reside in a JEE container.
- Open your module settings.
- Add the
gwt-server.jarlibrary of your GWT installation to the list of libraries used by the IDEA module. - In the module settings, add a Web facet to the module.
- Configure the Web facet like you would normally configure Web applications.
- Ensure the
gwt-server.jarlibrary is configured to be included into /WEB-INF/lib as part of the web module packaging step. - Configure the GWT facet to deploy the files to the Web facet.
Notes
The central points are to create a Web facet and to create and configure a GWT facet.
Comments 1
Thank you for a great tutorial!
Posted 03 Aug 2008 at 5:57 pm ¶Post a Comment
You must be logged in to post a comment.