Friday, May 21, 2010

Simple Google Web Toolkit Project with Spring Roo

After watching Google I/O 2010 Keynote (Day 1, pt. 9) from Youbube, I cannot wait to have a try on Spring-Roo 1.1.0M1 with GWT 2.1 Milestone 1. In this post, I will follow Ben's demonstration on Google I/O to create the same project using SpringSource tool suite with Google integration.

1. Setup development enviornment

Download SpringSource Tool Suite (STS). We need version 2.3.3.M1 which has Google integration.
Then use its extensions dashboard to install the Google Plugin for Eclipse:



2. Create Roo project

In STS, click "File->New->Roo Project",
Then "Next", "Finish".
You will see our "demo" project appears in Package Explorer after output some building information from Console. Now switch to "Roo Shell" tab, we are ready to type in some commands.


3. Develop our project using Roo.

It's time to start our Roo journey, type command in "Roo Shell":

setup persistence:
persistence setup --provider HIBERNATE --database HYPERSONIC_IN_MEMORY
create Employee entity class with two properties:
entity --class ~.server.domain.Employee
field string --fieldName firstName
field string --fieldName lastName

add gwt support:
gwt setup
However, I occurs an error after this command,
"The project 'demo' does not have any GWT SDKs on its build path"
So I add GWT Library to this project manually:
right click on "demo" project, "Build Path"->"Add Libraries", choose "Google Web Toolkit".

let's roo do pack:
perform package

That's all, let's quit Roo:
quit

now open any command line tool you prefer, "cd" into the "demo" project directory,
mvn gwt:run


in the "GWT Development Mode" windows, click "Launch Default Browser":


8 comments:

Mohamed said...

error
when I enter perform package
this error came out:
Cannot run program "mvn.bat" (in directory "C:\Users\Miro\Documents\workspace-sts-2.3.3.M1\Hello"): CreateProcess error=2, The system cannot find the file specified

Ke Cai said...

dude, you need to setup Maven first.
make sure mvn.bat in your path.

maddy said...

Realy nice views discussed hre in this post i wud like to say thanxs to all the peoples here sharing these views with me

badcluster said...

Ke Cai, nice post. Works fine.
So, do you know if is it possible to integrate with spring security and authenticate users?
Thanks!

Atomic said...

Currently, Roo 1.1.0M1 does not support entity references in GWT, so it is too early to test development with it. Hopefully they implement it in M2.

Jack Kennedy said...

you may want to look at MyEclipse for Spring’s GWT generation which we recently released in Milestone 2. We support generated relationship management etc from JPA, RDBMS, or standard POJO’s. It also support Spring Security generation.

You can find short videos of these capabilities here.

YouTube Page
http://www.youtube.com/user/myeclipseforspring

Getting Started Video: http://www.youtube.com/watch?v=4tKGvbxk1-Y

Tutorial: http://www.skywayperspectives.org/documentation/me4s86/html/ME4STutorialScaffoldingGWT/m4sescaffoldinggwtarticle.html

Installer: http://www.myeclipseide.com/Downloads-req-viewsdownload-sid-38.html

john said...

hi
i have created 2 roo poject but i want to know how i can link and load both at same time when i load 1 project

Adel Rafiq said...

I still getting the "mvn.bat" error. I put the file in the build path.