blob: ae639ddbaa8d34bda94a971751477a776b988f22 [file] [log] [blame]
gwt.team.scottbfeecde52007-11-30 19:12:03 +00001Eclipse 3.3.X instructions
2
3These instructions are intended for contributors to the GWT source
4code repository that want to run the Eclipse IDE. It describes how to
5configure Eclipse for the correct coding styles and how to setup a GWT
6project for debugging the core GWT code.
7
8
9== Configure Eclipse Environment==
10
11 All relative paths are relative to the GWT source repository's
12 'trunk/eclipse' folder. For best results, launch Eclipse from the
13 trunk/eclipse folder from the command line.
gwt.team.jat950681a2006-12-21 00:13:44 +000014
15---------- Required GWT variables ---------
16
17Window->Preferences->General->Workspace->Linked Resources
gwt.team.jate24e8272007-01-09 17:02:18 +000018Create a variable named "GWT_ROOT" pointing to your "trunk" folder.
gwt.team.jat950681a2006-12-21 00:13:44 +000019
20Window->Preferences->Java->Build Path->Classpath Variables
gwt.team.jate24e8272007-01-09 17:02:18 +000021Create a variable named "GWT_TOOLS" pointing to your "tools" folder.
22Create a variable named "JDK_HOME" pointing to the root of your JDK install
23 (for example, C:\Program Files\jdk1.5.0_05 or /usr/lib/j2sdk1.5-sun)
gwt.team.jat950681a2006-12-21 00:13:44 +000024
25---------------- Spelling -----------------
26
gwt.team.jat276a80f2007-01-04 15:50:01 +000027Window->Preferences->General->Editors->Text Editors->Spelling
gwt.team.scottbfeecde52007-11-30 19:12:03 +000028Enable spell checking
29Use "settings/english.dictionary".
gwt.team.jat950681a2006-12-21 00:13:44 +000030
31------------ Output Filtering -------------
32
33Window->Preferences->Java->Compiler->Building
34Make sure "Filtered Resources" includes ".svn/"
35
36---------- Code style/formatting ----------
37
38Window->Preferences->Java->Code Style->Formatter->Import...
gwt.team.scottbfeecde52007-11-30 19:12:03 +000039 settings/code-style/gwt-format.xml
gwt.team.jat950681a2006-12-21 00:13:44 +000040
41----------- Import organization -----------
42
43Window->Preferences->Java->Code Style->Organize Imports->Import...
gwt.team.scottbfeecde52007-11-30 19:12:03 +000044 settings/code-style/gwt.importorder
gwt.team.jat950681a2006-12-21 00:13:44 +000045
46------------ Member sort order ------------
47
48Window->Preferences->Java->Appearance->Members Sort Order
gwt.team.bruce6e05b042007-03-13 17:39:06 +000049There is no import here, so make your settings match:
gwt.team.scottbfeecde52007-11-30 19:12:03 +000050 settings/code-style/gwt-sort-order.png
gwt.team.bruce6e05b042007-03-13 17:39:06 +000051
52First, members should be sorted by category.
531) Types
542) Static Fields
gwt.team.scottbfeecde52007-11-30 19:12:03 +0000553) Static Initializers
gwt.team.bruce6e05b042007-03-13 17:39:06 +0000564) Static Methods
575) Fields
586) Initializers
597) Constructors
608) Methods
61
62Second, members in the same category should be sorted by visibility.
631) Public
642) Protected
653) Default
664) Private
67
gwt.team.scottbfeecde52007-11-30 19:12:03 +000068Third, within a category/visibility combination, members should be sorted
gwt.team.bruce6e05b042007-03-13 17:39:06 +000069alphabetically.
gwt.team.jat950681a2006-12-21 00:13:44 +000070
gwt.team.scottbfeecde52007-11-30 19:12:03 +000071== Checkstyle ==
72
gwt.team.scottb3f1f1a02007-08-28 19:27:49 +000073Checkstyle is used to enforce good programming style.
gwt.team.jat950681a2006-12-21 00:13:44 +000074
gwt.team.scottb3f1f1a02007-08-28 19:27:49 +0000751. Install Checkstyle
76
77The Eclipse Checkstyle plugin can be found at:
gwt.team.scottbfeecde52007-11-30 19:12:03 +000078 http://eclipse-cs.sourceforge.net/
gwt.team.jat950681a2006-12-21 00:13:44 +000079
gwt.team.scottb3f1f1a02007-08-28 19:27:49 +0000802. Enable Custom GWT Checkstyle checks:
81
82Copy "settings/code-style/gwt-customchecks.jar" into:
gwt.team.scottbfeecde52007-11-30 19:12:03 +000083 <eclipse>/plugins/com.atlassw.tools.eclipse.checkstyle_x.x.x/extension-libraries
gwt.team.scottb3f1f1a02007-08-28 19:27:49 +000084
85Restart Eclipse.
gwt.team.scottbfeecde52007-11-30 19:12:03 +000086("gwt-customchecks.jar" is also built from source into build/lib during a full
87 build)
gwt.team.scottb3f1f1a02007-08-28 19:27:49 +000088
893. Import GWT Checks:
gwt.team.jat950681a2006-12-21 00:13:44 +000090
91Window->Preferences->Checkstyle->New...
92Set the Type to "External Configuration File"
93Set the Name to "GWT Checks" (important)
94Set the location to "settings/code-style/gwt-checkstyle.xml".
95Suggested: Check "Protect Checkstyle configuration file".
96Click "Ok".
97
gwt.team.scottb3f1f1a02007-08-28 19:27:49 +0000984. Import GWT Checks for Tests
99
100Repeat step 2, except:
gwt.team.bruce6e05b042007-03-13 17:39:06 +0000101Set the Name to "GWT Checks for Tests" (important)
102Set the location to "settings/code-style/gwt-checkstyle-tests.xml".
gwt.team.scottbfeecde52007-11-30 19:12:03 +0000103
104== Importing the GWT core projects ==
105
1061) Import the 'gwt-dev-<platform>' and 'gwt-user' projects
107
108 File->Import->General->Existing Projects into Workspace->Next
109 Browse to the 'trunk/eclipse' folder and select it
110 Deselect All
111
112 Inside this folder are a number of .projects files, only a few of
113 which you will need to get started. You may import others later.
114
115 Select 'gwt-dev-<platform>' appropriate to your OS
116 Select 'gwt-user'
117 Select any of the GWT samples as you want. The most useful ones are:
118 - Hello: very simple project useful as a little playground
119 - KitchenSink: complex UI application
120 - DynaTable: uses RPC
121 Then press the Finish button.
122
123 Non-windows users: By default, gwt-user depends on gwt-dev-windows, which you
124 will not have imported. You must update the gwt-user project configuration
125 to depend on gwt-dev-linux or gwt-dev-mac (whichever one you imported). This
126 can be done by editing gwt-user's .classpath file directly, or through the IDE
127 under Project->Properties->Java Build Path->Projects.
128
1292) Dismiss the welcome tab if you are setting up an Eclipse workspace
130 for the first time.
131
132 You should noew have several new projects in your Eclipse workspace.
133 If you are lucky, they will compile too!
134
135 If they did not compile, recheck the setting of
136
137 - GWT_ROOT
138 - GWT_TOOLS
139 - JDK_HOME
140
141 Then refresh each project.
142
1433) Finally, drop to the command line and build the project
144 using 'ant'. You may need to first download ant from the web:
145
146 http://ant.apache.org/
147
148 Run the ant installation procedure.
149
150 Before you continue, make sure that the 'ant' binary is on your path.
151
152 $ cd <gwt>/trunk/
153 $ ant
154
155 This only has to be done once to create the 'trunk/build/staging/...'
156 directories. After you build from the command line once, you can
157 use Eclipse's built in compiler.
158
159
160== Launching 'Hello' ==
161
162While the 'projectCreator' and 'applicationCreator' scripts are useful for
163setting up projects and launch configurations that target a GWT installation,
164they are not intended for GWT developers working against the source code. You
165will want to run not against .jar files, but against the class files build by
166Eclipse. The following instructions help you do just that.
167
1681) Import the 'Hello' project if you haven't already.
169
170 File->Import->General->Existing Projects into Workspace->Next
171 Browse to the 'trunk/eclipse' folder and select it
172 Deselect All
173 Select 'Hello'
174
1752) Non-windows users: Replace the gwt-dev-windows project dependency and paths.
176
177 Run->Open Run Dialog...->Java Application->Hello
178 Select the 'Classpath' tab
179 Remove gwt-dev-windows paths
180 Select 'User Entries'
181 Advanced->Add Folder-> Add gwt-dev-<platform>/core/super
182 Select the (default classpath) item and use the 'Down' button
183 to make it the last item in the list.
184 You could also just edit Hello.launch and search/replace "windows" with
185 "linux" or "mac".
186
1873) Modify the the gwt.devjar VM argument
188
189 Run->Open Run Dialog...->Java Application->Hello
190 Select the 'Arguments' tab
191 Modify the 'gwt.devjar' setting in the VM arguments window
192
193 -Dgwt.devjar=<path to trunk>\trunk\build\staging\gwt-<platform>-0.0.0\gwt-dev-<platform>.jar
194
1954) Repeat steps 2 and 3 for the 'Hello compile' project.
196
1975) Now you should be able to run the 'Hello' project from the
198 Run dialog!
199
200
201== Creating a Launch config for a new project ==
202
203The simplest way to create a new launch config is to use the Run dialog to
204duplicate the 'Hello.launch' and 'Hello compile.launch' configurations and
205then edit the arguments and classpath settings to match your new project.
206
207
208== Recreating a Launch configuration from scratch ==
209
210This section captures the process used to create the original 'Hello.launch'
211
2121) Create or Import a new project
213
214 Using the 'projectCreator' and 'applicationCreator' scripts is
215 an easy way to do this, but you cannot use the created launch
216 scripts to develop the GWT core source because they are
217 configured to run with .jar files from a GWT installation.
218
2192) Add a project reference to the gwt-user project:
220
221 Project->Preferences...->Projects Tab->Add...
222 Add 'gwt-user' as a project dependency.
223
2242) Create a new launch configuration
225
226 Select the project in the tree on the left of the Main Window
227 Open the Run... dialog
228
229 Create a new Java Application.
230
231 Main Tab:
232 Name: Debug Launch Config
233 Project: <your project>
234 Select the checkbox "Include inherited mains when searching for a main class"
235 Main class: com.google.gwt.dev.GWTShell
236 (Note: the 'Search' button may not work, just type it in without a search.)
237
238Arguments Tab:
239 In the 'Program arguments' text area, add the name of the module
240 host web page and any other hosted mode arguments:
241
242 -out www
243 <your module package>.<module name>/<module name>.html
244
245 e.g.
246 -out
247 www com.google.gwt.sample.hello.Hello/Hello.html
248
249 In the 'VM arguments' text area, add the following:
250
251 -Dgwt.devjar="<path to trunk>/build/staging/gwt-<platform>-0.0.0/gwt-dev-<platform>.jar"
252
253 This is a very obscure way of telling GWT where to find the C++ libraries
254 located in that directory. The name of the .jar file is not important,
255 but the path is. If you do not have this set, you'll see the
256 following exception at startup:
257
258 Exception in thread "main" java.lang.ExceptionInInitializerError
259 Caused by: java.lang.RuntimeException: Installation problem detected,
260 please reinstall GWT
261
262
263 Other VM arguments you might want to add:
264 -ea (enable assertions)
265 -server (enable java server VM)
266 -Xcheck:jni (adds extra checks before passing args to a JNI method)
267
268Classpath:
269 Click on 'User Entries' and use the 'Advanced' button to add the following folders:
270 <project>/src
271 gwt-user/core/src
272 gwt-user/core/super
273 gwt-dev-<platform>/core/super
274
275 Now, select the default classpath (Hello) and move it all the way
276 to the bottom of the list using the 'Down' button.
277
278 You should now be able to run the application
279 using the Eclipse launcher.