Skip to content

c0debrain/gwt-messenger-example

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Example Gradle + GWT + Google App Engine project

A sample build of this project can be found at: https://fair-myth-128602.appspot.com/

Dependencies

  • JDK 8 with JAVA_HOME set
  • Chrome browser (optional)

How to...

IDEs

We can use any IDE that can import a Gradle project. Both Intellij and Eclipse are good options.

Development mode

Run the following commands in daemon mode or as separate processes:

>>>gradlew appengineRun
>>>gradlew gwtSuperDev

These commands boots up two local servers:

  • SuperDevMode at http://localhost:9876 which listens to requests to recompile your code
  • AppEngine at http://localhost:8080 which serves the app itself

Go to SuperDevMode server in your browser and follow the instructions to save the bookmarks that allow you to recompile your app. Now you can go to the AppEngine server to view your app. If you don't see anything, click on the Dev Mode On bookmark you saved earlier and then hit Compile on the opened modal. This will sent a request to SuperDevMode server to initiate a recompile and reload your page.

You can avoid the modal by bookmarking the Compile button for one-click compile + reload.

Note: it is also recommended to use Chrome browser to debug your applications as it fully supports source maps used by GWT.

Deploy

Stop your local App Engine server then:

>>>gradlew appengineUpdate

This uploads the app to App Engine. It will override the version (defined in appengine-web.xml) on App Engine if it exists or else it will create that version.

If the uploaded app has a new version, run:

>>>gradlew appengineSetDefaultVersion

to tell App Engine to start serving the new version on production.

Project structure

Layout

  • src/main/java/webapp/ contains web application sources as specificed by the war plugin for Gradle.
  • src/main/java/com/jingyu/example/ contains all the GWT and App Engine application logic.

Important files

  • src/main/java/com/jingyu/example/Example.gwt.xml this is the main GWT configuration file.
  • src/main/webapp/WEB-INF/web.xml this is the main url routing file.
  • src/main/webapp/WEB-INF/appengine-web.xml configuration file for App Engine.

Ignored files and folders

  • Generated by Gradle:
    • .gradle/: Gradle settings
    • build/: Compiled Javascripts and resources
    • war/: Mirrors src/main/java/webapp/
  • Generated by Eclipse:
    • bin/: Temporary build files
    • .project: Main Eclipse project file
    • .classpath: Classpath information for Eclipse
    • .settings/: Misc settings
  • Generated by Intellij Idea:
    • .idea: IDE settings

Some common errors

  • the import com.google.appengine cannot be resolved

    • Problem: You are trying to use App Engine in the client code.
    • Solution: Don't do it.
  • Rebind result 'com.something.something.SomeServiceAsync' must be a class

    • Problem: You are trying to create an async service from an async class.
    • Solution: You have to create the async service from the synchronous version of the service. The GWT compiler does some runtime magic to mash the interfaces.
  • Getting 404s for RPCs?

    • Did you map the servlets to url in web.xml?
    • Did you restart the App Engine server after you made changes server side?

Resources

Official links

Other helpful guides (may not be compatible with this one)

Todo...

  • Port over more example code and comments from the example project generated by Google Plugin for Eclipse
  • Basic UiBinder stuff
  • Material Design
  • MVC with GWTP?
  • Tests

About

A simple messenger built upon the Google App Engine

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 91.9%
  • HTML 5.3%
  • CSS 2.8%