forked from richkadel/owf-gwt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BUILD.txt
218 lines (152 loc) · 8.9 KB
/
BUILD.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
Notes on the build:
1. You may need to increase Maven's memory to compile. I did this by
setting the environment variable:
export MAVEN_OPTS=-Xmx1024m
2. To create the war file:
mvn install
Run this from owf-gwt. This will install owf-gwt-main jar in your maven repository,
which owf-gwt-test war needs; and then it builds the owf-gwt-test war in
target.
3. To run in DevMode (note this is much slower than running in SuperDevMode or
production mode...I use SuperDevMode exclusively now, for many reasons):
cd owf-gwt-test
mvn gwt:run
Then you should be able to "Copy to Clipboard" (button) in the GWT Dev Mode window and
paste the URL in old versions of Firefox that still support DevMode, or into Chrome.
4. To run the app in "production mode" (WAY faster with GWT running natively),
I deploy to Tomcat. Simply create a owf-gwt.xml file in tomcat's
"conf/Catalina/localhost" with the following content:
<?xml version="1.0" encoding="UTF-8"?>
<Context
docBase="[ !! your home directory and path to owf-gwt here !! ]/owf-gwt-test/target/owf-gwt-test-0.1.1-SNAPSHOT.war"/>
(Update the version number as needed.)
NOTE! There are some classes of bugs that could appear in production mode that don't show up in
dev mode, specifically, when using a JavaScript overlay object, accessing a
JsArray property, if that property is not actually in the underlying JavaScript object,
Dev Mode returns an empty JsArray, but Production Mode, it crashes with an exception.
This is one of the reasons I run in SuperDevMode now. I uncover these bugs immediately.
By default, GWT production mode exceptions are not very informative. I couldn't
see where the bug was happening because of obfuscation. You can change that with the
following settings that sacrifice some code size for readable stack traces
(file name and line number). Put this in all of your gwt.xml files. If you want to
optimize for *real* production later, you just comment this out and rebuild:
<set-property name="compiler.stackMode" value="emulated" />
<set-configuration-property name="compiler.emulatedStack.recordLineNumbers" value="true"/>
<set-configuration-property name="compiler.emulatedStack.recordFileNames" value="true"/>
See, for example, owf.gwt.xml.
5. For eclipse, there are several preliminary requirements.
Upgrade to GWT Plugin 2.6(.x). I installed it through the Eclipse Marketplace, installing Google
Plugin for Eclipse 4.3.
I also installed the GWT M2E Connector, which bundled m2e (which is needed).
IMPORTANT! You also need Maven Integration for WTP! Make sure you install it. (There
is a version for Juno, and probably prior Eclipse versions, in the Marketplace.)
Finally, you should increase your memory configurations for Eclipse. Find the
eclipse.ini file, and increase
or add -XXPermSize, -XXMaxPermSize, -Xms, -Xmx. Here's the -vmargs section from my
eclipse.ini. Note the increased values:
-vmargs
-XX:PermSize=256m
-Dosgi.requiredJavaVersion=1.6
-XstartOnFirstThread
-Dorg.eclipse.swt.internal.carbon.smallFonts
-XX:MaxPermSize=512m
-Xms512m
-Xmx1024m
-Xdock:icon=../Resources/Eclipse.icns
-XstartOnFirstThread
-Dorg.eclipse.swt.internal.carbon.smallFonts
6. Import -> Maven -> Existing Maven Projects. Browse to the "owf-gwt" directory, and
select it. By default, the "owf-gwt" pom.xml and all of its sub-projects should be
checked, but you may need to enable an option to show sub-projects, and they should
all be selected. Optionally, you can select or create a Working Set to attach these
projects to, but you can also wait until after importing the project to do this, once
you get a feel for the layout. I PREFER adding them to a Working Set because they
all come up as separate projects, including the top-level project "owf-gwt".
7. Open the Project Properties for "owf-gwt-test" and select "Project
Facets", then click "Convert to faceted form..." This then allows you to add the Facet
for "Dynamic Web Module".
NOTE: Maven Integration for WTP may restrict the version
of "Dynamic Web Module" to 2.5, and if you don't have the Maven WTP plugin installed
you will get screwed up later. Don't select 3.0 unless you are sure you have
Maven Integration for WTP installed and it accepts this later version of
"Dynamic Web Module".
Check "Dynamic Web Module" and select "Apply". This may start a project validation.
You can wait for it to complete if necessary, but you may also be able to continue.
(The percent complete for validation shows at the bottom of the main Eclipse window.)
Eclipse might also crash during the validation (often due to insufficient heap space).
Restart if required. If you increased Eclipse memory settings as described above,
hopefully this command will complete cleanly and quickly.
I also sometimes prefer disabling some of the validations. In Project
Properties, under "Validation", you can enable project specific settings and turn
off validation for HTML or XML, if it is getting stuck on one of those; or you can
disable validation all together.
11. Also in the Project Properties, select and open the Google section and select
"Web Toolkit". Check "Use Google Web Toolkit", and ensure GWT 2.6.0 or 2.6.1 (or later)
is selected.
The "Entry Point" module should be "owftest - owf" (or similar).
At this point, I also selected "Configure SDKs" and changed the default GWT to 2.6.0,
then ensured this project was configured to use that version. The owftest
Entry Point was automatically selected.
12. Also under the Google section, select "Web Application" and check "This project has
a WAR directory. Set the WAR directory to "src/main/webapp".
13. Under Project Properties, go to the Java Build Path, and select "Source" at the
top. It should already be set correctly, but ensure the "Default output folder" is:
owf-gwt/target/owf-gwt-0.0.1-SNAPSHOT/WEB-INF/classes
Click the OK button to close Project Properties and accept the settings thus far.
We are not finished, but Eclipse needs to reconfigure a few other settings before
we can make the final tweaks.
At this point, I had problems and Eclipse wouldn't let me click OK, so I clicked cancel,
then re-opened the Project Properties, and re-set the Google settings again.
14. Under Project Properties, go to "Deployment Assembly", a new section that appears
only after adding the "Dynamic Web Module" facet in the earlier step.
Remove the "/WebContent" entry.
Add the following:
Folder: "src/main/webapp" (this should automatically indicate "Deploy Path" is "/")
Java Build Path Entry: "Maven Dependencies"
[WARNING: If Eclipse is not accepting the "Maven Dependencies" it's probably because
you don't have the eclipse plugin "Maven Integration for WTP". Install it from
the marketplace for your Eclipse version. If you get an error saying you have
a Facet for Dynamic Web Module set to the wrong version (e.g., if you had it
set to 3.0 and Eclipse Integration for WTP requires 2.5), you will have to delete
and re-create your project. Sorry, but this shouldn't happen if you installed
Eclipse Integration for WTP from the beginning.]
Click "Apply".
You may wish to restart Eclipse.
I restarted. Then I noticed some syntax errors because the project had reset to Java 1.6
and I was using some 1.7 syntactic sugar. The "Quick Fix" option automatically reset
my project to 1.7 and the syntax errors disappeared. But I am trying to maintain 1.6
compatibility, so, please remove 1.7 features.
15. Set up the Run Configuration for the GWT app (this works for DevMode and also as
an excellent, simple built-in HTTP server to use when running in SuperDev mode:
Type is Web Application (Google "G" icon)
Name: "owf-GWT" or whatever
Project: owf-gwt
Main class: com.google.gwt.dev.DevMode
Under "Server", port 8888
Under "GWT", port 9997. The module should already be highlighted: owftest
Under "Arguments", enter the following runtime arguments:
[NOTE: The <path-to-your-project> needs to be updated to your project parent dir]
-remoteUI "${gwt_remote_ui_server_port}:${unique_id}" -logLevel INFO -port 8888
-startupUrl owf-gwt.html
-war /<path-to-your-project>/owf-gwt/owf-gwt-test/target/owf-gwt-test-0.0.1-SNAPSHOT
-codeServerPort 9997 owf.owftest
and for VM arguments:
-Xms1024M -Xmx2048M -XX:PermSize=256M -XX:MaxPermSize=512M
16. For SuperDevMode:
Create a Run Configuration of type Java Application. Name it
"owf-GWT SuperDevMode"
or something like that. Set the project to owf-gwt.
Set the main class to:
com.google.gwt.dev.codeserver.CodeServer
Set program arguments to:
-src <pathtodir>/owf-gwt/owf-gwt-test/src/main/java owf.owftest
(change <pathtodir> to the valid path)
and for VM arguments:
-Xms1024M -Xmx2048M -XX:PermSize=256M -XX:MaxPermSize=512M
And you PROBABLY need to add the following classpath User Entries:
"Advanced" entry -> Folder -> owf-gwt-test/src/test/jar
"Project" -> owf-gwt-main
gwt-user-2.6.x.jar
gwt-dev-2.6.x.jar
You SHOULD already see the gwt-dev jar in User Entries. If not, you will need to add it.
I added both of the GWT jars from my .m2/repositories directory under my home directory.