Wednesday, February 5, 2014

GWT - maven based project setup

Let's start with an empty maven web project.

Time to config the pom.xml

<project xmlns="" 





create the gwt module xml, under the package com.verydapeng.project.setup. let's call it prod.gwt.xml
<module rename-to="app">
    <inherits name="" />
    <entry-point class="com.verydapeng.project.setup.client.Entry" />
create the Entry class
package com.verydapeng.project.setup.client;


public class Entry implements EntryPoint {

    public void onModuleLoad() {
        Window.alert("hello world");

create the index.html

<!DOCTYPE html>
        <script src="app/app.nocache.js"></script>

Now we are almost done. The project view should be something like this now

Time to run the project!

create a custom action to run the gwt:run goal

wait the GWT dev mode to show up, click the Launch Default Browser button

and viola, Hello World. You may need to install the GWT plugin, if you haven't done so.

sample codes are available here under the Project-Setup folder

No comments :

Post a Comment