5

I am making web application using GWT toolkit in eclipse and my application is running successfully as we run from eclipse to right click on project and select Run as web project. But when i make war file from eclipse-ide to Right-click on the project, pick Export, then WAR file so it does'nt work.It give me error "enter module name" it does'nt detect automatically module name. it happens only when i make a web application with gwt plugin otherwise in simple web dynamic application war file create easily with eclipse ide.i want to know how to make a war file in eclipse? And how to deploy my gwt application with tomcat server? Thanks Rahul

Rahul
  • 119
  • 2
  • 12

4 Answers4

3

Take a look to this other question: create a .war file from gwt-project

In fact the real answer will depend if you want to use ANT or Maven.

Community
  • 1
  • 1
Carlos Tasada
  • 4,438
  • 1
  • 23
  • 26
1

WAR files are just compressed version of your built web app projects. One simple way to make them is to use jar.exe in JDK package. That's enough to run this command after building your project in eclipse to compress those files as a WAR file:

jar -cvf name_of_jar_file.war -C /path-to-app-built-dir /path-to-put-jar-file

Ehsan Khodarahmi
  • 4,772
  • 10
  • 60
  • 87
1

The best approach is to use the command

Export > Export ... > Web > War file

You will have this command on the context menu (right mouse button on the project folder) if you installed the Java tools for Web Applications. Otherwise that should you first step.

It may be the case that your GWT project doesn't show on the selector of the Web Project field, the first on on the dialogue box when you execute the command above. If this is the case you must make sure you have the Dynamic Web Module facet on you project. Select the project root project navigator and then execute

Properties > Project Facets

and check Dynamic Web Module on the right panel if it not already checked.

You should make sure that the WAR directory used by GWT is the same used by the dynamic web module. If you are not sure what is your WAR directory (probably it's the one named "war") you can go to

Properties > Google > Web Application

and read the content of the field WAR directory on the right panel.

Then make sure that the WAR directory is specified in the "Web Deployment Assembly". You need to go to

Properties > Web Deployment Assembly

and check if your WAR directory is listed there. If you war directory is "war" then you should have /war on one of the rows with the deploy path /. Otherwise

  • press Add...
  • select Folder
  • press Next
  • select your WAR folder (e.g. war)
  • press Finish

If you fail to make your WAR directory part of your Web Deployment Assembly them the Export > Web > WAR command will create a WAR file, but it will lack the web.xml and all the static files on the WebContent folder, such as the HTML, images, etc.

jpleal
  • 161
  • 7
-1
  1. Open your project.
  2. Navigate to war folder.
  3. Go to File>Export>Archive File
  4. Export your war FOLDER as zip file.
  5. Change your file extension form .zip to .war
  6. Keep calm and enjoy your war file.
MDJ777
  • 5
  • 3