Database Reverse Engineering with Spring Roo 1.2

Reverse engineering an existing database into a new application seems to be one of the most important features in rapid application development. Having the right tools at hand can give you a major boost when rewriting an application on top of an existing database.

Spring Roo hasn’t had support for Database Reverse Engineering (DBRE) when its first major version was released. Not surprisingly, adding DBRE support had been the most requested feature for subsequent versions. In Roo 1.1 full support for incremental DBRE was added and since then it has been constantly improved. It is fully documented and pretty much straight forward to use.

According to my WordPress Stats, my old post about DBRE in Roo is still the second most visited on my blog. As it became more than obsolete, I thought it might be time to clear things up and point you guys to the new DBRS features in Spring Roo 1.1.x and 1.2.x

So if you are interested in Roo and/or DBRE, make sure to check out the latest developments in this area.

Missing Snapshot Dependency in Spring Roo Project

Today I ran into an error while trying to create a plain new Spring Roo project based on the latest nightly snapshot build of Roo.

[ERROR] Failed to execute goal on project cassandra: Could not resolve
dependencies for project cassandra:cassandra:jar:0.1.0.BUILD-SNAPSHOT:
Failure to find org.springframework.roo:org.springframework.roo.annotations:
jar:1.2.0.BUILD-SNAPSHOT in http://maven.springframework.org/release was
cached in the local repository, resolution will not be reattempted until the
update interval of spring-maven-release has elapsed or updates are forced

 
The solution to the problem is quite easy. Just intsall the org.springframework.roo.annotations-1.2.0.BUILD-SNAPSHOT.jar into your local maven repositroy (or alternatively your company’s repository server). The file itself can be found in the unpacked roo installation folder under spring-roo-1.2.0.BUILD-SNAPSHOT/annotations. To install it into your local repository, execute:



mvn install:install-file -DgroupId=org.springframework.roo
-DartifactId=org.springframework.roo.annotations -Dversion=1.2.0.BUILD-SNAPSHOT
-Dpackaging=jar -Dfile=org.springframework.roo.annotations-1.2.0.BUILD-SNAPSHOT.jar

Roo 1.1.0 released and millionth question on stackoverflow

Ben Alex and his team down here in Sydney have successfully released Spring Roo 1.1.0. The feature list is long. Promising ones like GAE & GWT Integration as well as Incremental Database Reverse Engineering capabilities are just some of the highlights. Make sure to take a look at Ben’s blog post or visit the official Roo site.

Meanwhile another impressive project has reached a further milestone. Stackoverflow is growing faster and faster and has now listed more than one millionen (1.000.000 !) questions asked and answered by professional and enthusiastic programmers. If you are not yet a member of this fantastic community, make sure to join today!

Spring Roo at JUG Stuttgart – Presentation Slides available

The presentation slides of my Spring Roo introduction talk at the Java User Group Stuttgart are now available. Thanks to the audience for the feedback and interesting discussions after the presentation.

Die Vortragsfolien zur Spring Roo Einführung bei der Java User Group Stuttgart sind jetzt online. Vielen Dank an die Zuhörer für das Feedback und die interessanten Gespräch nach dem Vortrag.

http://www.jugs.org/protokolle2010.html#14062010

Building Spring Roo from Source

Spring Roo 1.1.0 M1 has just been released and the development on 1.1.0 M2 is just about to start. If you want to check it out from the development stream and see the latest features, here is the tutorial you need. If you are running a Windows operation system this task is quite a bit more challenging. All you ubuntu (and most of the other *nix systems) users only need to do this:

sudo apt-get install git-core gitk
git clone git://github.com/SpringSource/spring-roo.git
cd roo
mvn clean install
sudo ln -s bootstrap/roo-dev /usr/bin/roo-dev

Thats it, seriously! For all the Windows users, read the following paragraphs to accomplish the same.

Installing Git on Windows

First of all you need to install a version of Git for Windows. I decided to not go with the Cygwin + Git option, but instead install Msysgit. A third alternative for Windows is to use Egit for Eclipse, I may discuss that in a couple of days here as well.

There is a nice blog post by Kyle Cordes on the installation of Msysgit. In my case I downloaded version 1.7.0.2-preview double-clicked it and kept all the default installation options (this changed the font style of my cmd shell, but I could change it back later).

Edit: If you get an error like this one Result of cmd.exe /X /C “git log “–pretty=format:Git-Commit-Hash: %H” -n 1″ execution is: ’1′. you should add {Msysgit_installation}/cmd to your PATH environment variable.

Getting Roo Sources via Git

In the next step you need to create a local clone of the current Roo sources by using Git. Therefore you should create a new folder in which you want to store the files. Right-click that folder and select Git Bash from the context menu. The git command bash opens.

Enter git clone git://github.com/SpringSource/spring-roo.git and wait till it is finished. This will create a new folder named roo. You should see something similar to the picture below.

Roo setup 3

Building Roo Sources via Maven
Open a windows command shell and switch to the created roo folder. Build the project by typing mvn clean install. (I assume you already have Maven 2 installed, if not do so now). Wait again, this may take a couple of minutes.

Configure Roo-Dev
The last thing you need to do is setting up an environment variable called ROO_DEV_HOME in your system settings, which should point to the bootstrap folder within the roo folder. You also need to add this variable to your path environment variable. See the screenshots below (sorry, that those are in German. I guess you mange to set up environment variables anyhow).

Roo setup 1

Roo setup 2

Using Roo-Dev
You can now use your build development version of Roo. Just open the windows command shell, type mkdir myproject, cd myproject and roo-dev. By now you should see something similar to the below picture. If so, congratulations! You are now running the current development version of Spring Roo.

Roo Setup 4

Updating Roo-Dev
You may want to update your Roo development version from time to time. Therefore open the GIT shell as you done have before. This time type git pull, which will pull all the remote changes into your local clone. Do not forget to run mvn clean install afterwards to build the changed sources.

Spring Roo database reverse engineering

This post is about Database Reverse Enigneering (DBRE) in Spring Roo 1.0.x only!

For DBRE in Roo 1.1.x and 1.2.x have a look at this post.

 

Tom Chikoore has written a nice tutorial on how to do database reverse engineering with the current Spring Roo version (1.0.x family). Having database reverse engineering capabilities is one of the most requested features for Roo right now (see Jira Issue), and will hopefully be implemented in Roo 1.1. But until then the trick by Tom is quite useful to prototype applications with Roo and an existing database. Thanks to Tom for the excellent work.

The link to Tom”s tutorial:

http://tomchikoore.com/2010/03/19/tutorial-for-using-spring-roo-with-an-existing-database/

A first insight into Spring Roo

I couple of days ago I gained my first insight into Spring Roo, a promising build tool for Java/Spring applications. There has been a talk by Eberhard Wolff, given at the Java User Group Hessen in Kassel. It was very interesting to see the (Kanga)Roo jumping out of the box and building a full stack Java application in minutes. Spring Roo’s goal is to help developers to rapidly build best practice Spring applications in Java. From what I have seen Spring Roo may be a big productivity burst in developing Spring applications from scratch using all the technologies you like and have used for many years (Spring, Spring MVC, Spring Security, JPA, Hibernate, Bean-Validation…).

Even though Spring Roo is already in Version 1.0, at some points it didn’t look that stable and complete. I assume there will be a lot of development going on in the coming year. So check out the project, cause now is the time when you can influence the direction the project is steering towards. And if Spring Roo is picked up and supported by a strong community I guess we will have a powerful rapid application development tool for Java/Spring in the future.

There is one thing about Spring Roo’s architecture I want to point out. I really like the way how generated code is separated from manually written code by using AspectJ inter-type declaration. Even though it might not be so intuitive to developers who have not been working with AOP so far. It is a more powerful and less error prone way in comparison to classical techniques like class inheritance and/or protected code segments in editable classes. While the generated code is physically stored in separated files, there is no runtime overhead as the AOP compiler weaves everything into one class file. You also gain a lot of benefits within your IDE (with AOP support) like compile-time checking, straight forward debugging, auto completion aso.

You find the slides of Eberhard’s presentation here: http://www.jugh.de/JUGH!/Dokumente/Eintrage/2010/2/25_Einfuhrung_in_SpringRoo%2C_Eberhard_Wolff_25.02.2010.html

More information is of course on the project site here (and as usual for Spring Source Projects the documentation is top!): http://www.springsource.org/roo

The wikipedia article is also kinda interesting (has a good list of supported Technologies and Add-Ons): http://en.wikipedia.org/wiki/Spring_Roo

There is also a free Spring Roo webinar comming on the 31 March given by the project founder Ben Alex. And I will give a short talk about Spring Roo at the Java User Group Karlsruhe on 24 March.