How do I create a .war-file from my gwt-project in eclipse?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
Compile your project. Then:
Using Eclipse:
when compilation has finished, the console will say i.e.
open a terminal and navigate to the directory
jar cv * > /tmp/myGWTproject.war
java -jar jetty-runner-8.1.7.v20120910.jar /tmp/myGWTproject.war
I always use Ant build file, so the project gets compiled and packaged as a war with one click.
Add an xml-file to your project with the following content:
(Edit `YourProject.EntryPointClass to the path to your EntryPoint-class)
You would need to add
gwt-user.jar
andgwt-dev.jar
to your projects build path(right click on your project -> Build Path -> Add External Achives).If you now look at your "Problems"-view you get a warning that the two files are not available on the server's class path. You can use the QuickFix to either copy it to
WEB-INF/lib
or hide the warning. The build file will not include those two file in the war-file.All you need to do to compile and create the file is to right click the xml-file and select run as Ant Build.
One can also use webAppCreator to generate Ant build file.
webAppCreator ships with GWT SDK and also with Eclipse GWT Plugin. First locate GWT plugin directory
this will output GWT plugin dir path. This dir has gwt dir something like gwt-2.4.0. WebAppCreator will be in this dir. Set this dir as GWTSDK_HOME.
make webAppCreator executable
Now create a project using webAppCreator in some temp dir.
in.m.fins.Fins is the module name. This has to match with your project's gwt.xml in Eclipse workspace. If your gwt.xml is src/in/m/fins/Fins.gwt.xml then module name should be in.m.fins.Fins
-out fins will create the project and build.xml in fins directory. Copy generated build.xml file to your project in Eclipse workspace.
Run war target in Eclipse Ant Window to package your project as war
You have to have GWT designer installed from here
That's it. Works on my GWT 2.4.0, Google Plugin for Eclipse 4.2, Eclipse Juno
For future reference: you'll find another tutorial on how to create a .war using Eclipse on http://blog.elitecoderz.net/.