How to run GWT in production mode

I am trying to run a GWT project in production mode according to the instructions https://developers.google.com/web-toolkit/usingeclipse . Therefore, my foo project is located in the foo folder on my desktop under the workspace folder. When I click on the foo project in the Project Explorer, click Google - GWT Compile , I see a message like permutations 1, 2.. , etc. in the debug console, After which it reports that the compilation is complete.

However, contrary to what the Google page says, additional HTML / Javascript files are not generated in the war folder. Also, if I type foo/war/foo.html in the URL bar, I get a timing error (even if the page contains only a simple alert call).

Can someone tell me what is going on here?

+2
java eclipse gwt
Feb 01 '13 at 15:53
source share
3 answers

If you work in GWT development mode after compilation

remove the gwt.codesvr=127.0.0.1:9997 in the url set by eclipse

After compiling the code, all gwt code is converted to javascript so that you can access it like a regular HTML page with the appropriate paths.

+8
Feb 01 '13 at 20:22
source share

If your GWT project is a Maven project, and you use the gwt-maven-plugin , you can run mvn jetty: run-war (for example, using this as the Eclipse Maven Run configuration target): this GWT will compile your project into war and run it on localhost, thereby launching Prod mode.

+1
Dec 30 '15 at 9:41
source share

This can only test ui functions in production mode. This is useful if this is all you need to do, especially if otherwise the server’s operation for production mode takes up the limited resource of your development machine that you want to save (whereas occupying them with a running server would be “unnecessary” if your testing does not have to make requests to this server).

If your GWT project ...

  • still does not make server requests for data (perhaps your project is still in its infancy) and ...
  • - project Maven

... You can...

  • GWT will compile your project
  • Maven package (these directions use gwt-Eclipse-maven-plugin ) your project
  • open the packed GWT host page in the browser (for example: index.html or <your module> .html according to your project / purpose / your version of the project and / or snapshot>). Profit!

This is enough to check the ui properties only for the project, thus in production mode. In fact, if your project has functions that make server requests for data, but you are not testing them, it will still work to test only those functions only for ui. In principle, any functions that request server data will not return these requests (since the server does not work for this), but all other functions will function, since they are only ui.

If you need to test the functions that make server requests for data, you will need to run production mode through the server (which will respond to requests). For example, with a Jetty server, see my other answer here.

0
Feb 14 '16 at 1:09
source share



All Articles