Sunday, September 2, 2012

GWT Project Development Environment - 1.Eclipse

Google Web Toolkit official website
1 Install Google Plugin for Eclipse

The downloading addresses against different versions of eclipse:

Eclipse 4.2 (Juno)

http://dl.google.com/eclipse/plugin/4.2

Eclipse 3.7 (Indigo)

http://dl.google.com/eclipse/plugin/3.7

Eclipse 3.6 (Helios)

http://dl.google.com/eclipse/plugin/3.6

Eclipse 3.5 (Galileo)

http://dl.google.com/eclipse/plugin/3.5
Fill in updating location by your eclipse version.

We select the requisite part only, Google Plugin for Eclipse(required). We will download GWT SDK manually later and link it and eclipse through Google Plugin. Google Plugin for Eclipse will become a bridge between eclipse and GWT SDK. Therefore we can manage GWT SDK easily with it, even Google App Engine SDK.
Another reason why we choose downloading by ourselves rather than installing directly with Google Plugin together is that it can be more convenient to manipulate GWT SDK with command line, because its directory is much simpler and more fixed. Especially after you add it into path of system environment, frequently changing eclipse plugins' directory as a result of various reasons causes its directory to be changed frequently.

2 Download GWT SDK
Google Web Toolkit downloading address
Please notice, if you access the link "Download GWT SDK" directly you will get the latest version, but this latest includes RC. Therefore you should use the link below if you are going to get the latest, stable and released version:
Unzip it after downloading, put it into a directory, the name of which had better be succinct and permanent. For instance, C:\GWT, of course you are going to use it for a long time.  

3 Manage GWT SDK with Google Plugin
Open eclipse Window --> References. If Google plugin was installed correctly there will be a new item, Google. In fact, if installed correctly you will find a new Google icon on tool bar.
Select Web Toolkit, click Browse..., locate GWT SDK. We can manage multiple GWTs of different versions, but let one work only. By the way, App Engine SDK can be added by the same way.

4 GWT_HOME (Optional)
If you want use command line to manipulate GWT SDK, it is undoubtedly the most convenient to add its location to path of system environment. No matter what folder you are in, you can use commands provided by SDK.
But this is not enough, when you create a GWT project, for example, run:

webAppCreator -out MyWebApp com.mycompany.mywebapp.MyWebApp

you will find it is also an ant project. So you need make sure an ant has been installed and set on your computer. Otherwise this project can't be compiled or run by command line.

5 End
You can start your first GWT project with your eclipse now.