The most challenging part of the problem is to write the Ant build.xml file. In order to solve this issue, I have used a small trick. GWT comes with a utility called webAppCreator which not only sets up the GWT project and creates some handy starter app code, but also provides a build.xml and JDT launch configuration file. The syntax is like below:
webAppCreator -out HelloGWT com.mycompany.mywebapp.HelloGWTIn order to generate the war archive, you just copy the build.xml into your project folder. I make changes accordingly in the following points:
1)arg value="com.mycompany.mywebapp.HelloGWT" => "
Another issues is whether you want to use Eclipse to make war file or use normal Ant builder.
If your choice is Eclipse, go to Run > External Tools > External Tools Configurations, and create a new Ant build, pick the build.xml for your project, your project as the base directory, then move to the Targets tab, and select the war target, deselecting the build target since war depends on build already. It's a good idea to name this Configuration "MyWebApp war" or similar. When the target is run, your code will be compiled into the war subdirectory, which will then be zipped into MyWebApp.war in the project directory.
In my case, I preferred to make war file on my own using Ant builder. I modified the build.xml as below
(remove target "war" and "clean")
Using command line to locate your project folder. Run "ant" => making war.