Wednesday, June 9, 2010

Spring Roo - GWT Tutorial

http://satukubik.com/2010/05/21/hello-world-using-spring-roo-1-1-0m1-under-sts-2-3-3m1/

The first day’s Google I/O keynote shows how much work has been done to integrate Spring Roo with GWT. Despite the fact that the demo is not smoothly done, this is kind of interesting combination. If before we have to do all the work to integrate Spring + Hibernate + GWT manually, now the work has already been done. Even nicer, it has tight integration with Eclipse, my favorite Java IDE .

Unfortunately the information on how to start creating and playing is not integrated and I spent quite some times to finally run a very simple application using all the technologies. Let me share my experience here…

What you need first is an STS 2.3.3M1. It’s not that easy to find, so here is the link: http://www.springsource.com/products/springsource-google-download. Unfortunately, you have to fill the forms as I can’t find another way to download it without filling the form. Warning, you need STS 2.3.3M1 not release 2.3.2.
Next you have to run the installer. I had no problem for this and at the end, the STS is nicely installed on my computer.
Run the STS and put the workspace location as you like.
If you start a new workspace you’ll get something like this:
Just close the Welcome page and you will get something like this:
You’ll need to install DataNucleus Eclipse Plugin and Google Plugin for Eclipse. To do so, go the third tab under the dashboard and select both extensions. Install it and restart the STS.
We can start creating a new project. Create a Roo project with name ‘hello’ and top level package ‘com.hello’. Wait a bit for Maven to download all the dependencies.
You can use Roo Shell to start adding entities to the project. Do following command:
1
persistence setup --provider DATANUCLEUS --database HYPERSONIC_IN_MEMORY
2
entity --class ~.server.domain.Employee --testAutomatically
3
field string --fieldName userName --sizeMin 3 --sizeMax 30
4
gwt setup


After that, you should right click on the project and select Google -> Web Toolkit Settings…. And then just click OK. I don’t know what happens but without it the application complain that it can’t find GWT SDK.
Again, right click on the project. Select Maven -> Enable Dependency Management.
Now you can run the application by right click on it and select Run -> Web Application. There you go you got the GWT version of the application.
Alternatively is to run mvn gwt:run from console or from Eclipse.


http://code.google.com/webtoolkit/business.html

No comments:

Post a Comment