Im Grunde genommen sind es nur zwei einfache Schritte, um aus dem GWT-Projekt ein .war zu erzeugen:
Kurzversion:
Als erstes wird ein .jar aus dem “src”-Verzeichnis des Projektes generiert, welches in das “lib”-Verzeichnis des “war”-Verzeichnisses des GWT-Projektes gelegt werden muß. Der zweite Schritt ist dann das eigentliche generieren der .war-Datei, welche dann auf den tomcat-server deployed werden kann. Um den zweiten Schritt etwas kompfortabler zu gestalten habe ich hierfür ein Ant-Script geschrieben, welches das eigentliche .war erzeugt.
Detailierte Version – Schritt 1:
| 1) Rechts-Klick auf das src Verzeichnis innerhalb des Projektes. | |
| 2) Das nebenstehende PopUp erscheint.
Aus diesem Menü “Export …” wählen. |
|
| 3) Nun “JAR file” als Export-Format wählen | |
| 4) Es darf nur das “src”-Verzeichnis des Projektes ausgewählt sein.
Als Ziel für den Export muß folgender Pfad angegeben werden: <Verzeichnis des Projektes>/war/WEB-INF/lib/<projectname>.jar – dann auf “Finish” klicken. |
Nun ist das GWT-Projekt soweit vorbereitet, daß es in ein .war gepackt werden kann um auf einem tomcat-Server deployed zu werden.
Detailierte Version – Schritt 2:
1) Es wird ein neues ANT-Script innerhalb des Projektes erstellt (Rechts-Klick auf das Projektverzeichnis, dann “New” und vom Untermenü “File” auswählen. Die neue Datei sollte z.B. “warbuilder.xml” heissen).
2) Folgender Inhalt muß in diese Datei kopiert werden. Dabei <projectname> durch den Namen des Projektes ersetzen:
<project name="<projectname>" basedir="." default="default"> <target name="default" depends="buildwar,deploy"></target> <target name="buildwar"> <war basedir="war" destfile=" <projectname>.war" webxml="war/WEB-INF/web.xml"> <exclude name="WEB-INF/**" /> <webinf dir="war/WEB-INF/"> <include name="**/*.jar" /> </webinf> </war> </target> <target name="deploy"> <copy file=" <projectname>.war" todir="." /> </target> </project>
3) Die ersten beiden Schritte müssen für jedes Projekt nur einmal ausgeführt werden. Danach kann der warbuilder.xml immer wieder benutzt werden. Um das .war nun zu erzeugen klickt man einfach mit der rechten Maustaste auf den warbuilder.xml und wählt vom PopUp-Menü den Punkt “Run as” und vom Submenü “Ant Build” aus.
Die .war-Datei wird dann durch das ANT-Script erzeugt. You will find the .war-file in your ProjectFolder.
Thanks for your posting. This article ‘s very helpful to me.
Yep! \o/
@Amit Kumar Das
Thanks, it appears to be just what I’m looking for to test my new (and first) Tomcat installation. I’ll try it Monday.
It appears that your script/application puts Time() at Time() in the message headers rather than Date() at Time().
Therefor I have no idea if this is a thread is still live…
Thank you ! it work fine
Good article Everything work fine but I have some problem.. when I open myPage.html it work fine but if I call my project by this url “localhost:8080/myProject/myPage.html”
I found error 404 can someone solve my problem
thanks for help. Nuttee From Thailand
plz forget my problem.. i solution it by mapping servlet in web.xml
Hi man,
roject.css
It looks really nice, but it’s not working here.
I do everything as said and when I run on tomcat it doesn’t work.
At chrome debugger it says:
Failed to load resource: the server responded with a status of 404 (Not Found)
Failed to load resource: the server responded with a status of 404 (Not Found) :8080/Project/project/servlet?
and the same for my other servlets
Any Idea of how to make it work??
Thankss!
Thank you!
It doesn’t seem like creating the .jar from the src folder is necessary. I’m not sure why it’s being done for deployment purposes? None of that code is compiled into either javascript or java. It seems like something that you would do if you were packaging everything into a jar file so that another module could inherit it and that other module would be able to run a debugger and see the source code.
Hi,
I followed your tutorial but I got the message “GWT module needs to be (re) compiled” once i try to access the app.
Can you tell me what I missed plz?
Thanx.