I always feel hesitation when it’s time to start a new project whether it’s a client project, a pilot project or just a test project. And it’s simply because I don’t know where to start from.
- IDE create new project ?
- mkdir project_name; vi build.xml ?
- Maven archtypes ?
- or probably brand new language and frameworks ?
I definitely don’t want to be stuck with IDE only. Ant… not really, almost everybody now is on Maven, so what’s the reason to continue to use legacy stuff?
Ok, Maven and then mvn eclipse:eclipse. Where to start with? Archetypes, right?
>mvn ...
Hmm..what’s next? Do you remember? I don’t. I did it like 10 times in my life and only at the beginning of a project and now I just forget. Google?
>mvn archetype_name:generate
Ok, and what should the ‘archetype_name’ be? Google again? Ended up in ‘AppFuse’ and now I have to select one of the 30+ options. Good God!
Could it be easier somehow? … oh, yes. Why not try a completely new approach with a new language? There are so many of them nowadays. They all come with web oriented frameworks, and they are all kind of oriented to make things easier.
Ruby, Groovy, … Pooby, Snooby .. what else? … and all are on rails. Sweet.
Ok, let’s be serious. We have millions of Java developers who do not want learn new languages. We have millions of enterprises who do not want to bring in new frameworks.
And again, is there something fundamentally wrong with Java for enterprise development?! I don’t think so. Why then should you try to jump in over your head?
Why not just sit and think about how you can improve your tools and go along with the stuff everybody knows and likes? I mean, Java is ok, Spring is nice, Hibernate is cool and annotations are brilliant.
So, just wrap them in human friendly way, create a generic reusable application infrastructure and voilà!
Don’t tell me about IDEs. Half a gig plugins like ‘Spring STS’ or ‘JBoss Tools’ freak me out. Tons of wizards, hundreds of context menus and dozens of weird project views.
I want to jump like a kangaroo over all of this stuff and straight into development without being involved with going through framework demo/examples to copy/create config files, setup libraries dependencies, wire technologies together and establish a build process. But I still want to stay with enterprise accepted technologies while being productive and agile. Be on the rails, but without overcomplicated new languages and frameworks.
Now, all you have to do, is just solve this JIRA task: http://jira.springframework.org/browse/ROO-1 . ![]()
And the guys from the ‘Spring Roo’ team are already in full charge on it.
Now I create an empty project folder and type ‘cr’ (for create) straight from the console and then press tab.
>cr <TAB> >create project
Wow, sweet. BTW, my console is kangaroo powered ![]()
What is next? Probably <TAB> again?
roo>create project -topLevelPackage
It’s obvious now, it will create a project and I only have to enter the root Java package name. Enter!
Project skeleton is created. Now I am about to add database support. How? Try <TAB>?
roo> */ /* // ; add configure database date development exit generate help hint insert install metadata new property props quit remove script version
‘install’ looks good for this task. So, ‘inst’ <TAB>:
roo> install install email provider install jms install jpa install security install web flow
‘jpa’ and <TAB> and <TAB> again:
roo> install jpa -provider ECLIPSELINK HIBERNATE OPENJPA
I don’t want to mess with mysql installation for development, so embedded Hypersonic is ok:
roo> install jpa -provider HIBERNATE -database HYPERSONIC_PERSISTENT
Now we have an application skeleton with database support. Need to create entity beans now. IDE? create JavaBean, create properties, generate get/setters, add annotations? What a mess! No!
Let’s try <TAB> again. Not really helpful now. How about asking system to help?
roo> hint You can create entities either via Roo or your IDE. Using the Roo shell is fast and easy, especially thanks to the TAB completion. Start by typing 'new p' and then hitting TAB twice. Enter the -name in the form '~.domain.MyEntityClassName'
Now I see: new p<TAB><TAB> and enter class name:
roo> new persistent class jpa -name ~.beans.EntityOne roo> add field string -fieldName name -class ~beans.EntityOne -sizeMin 3
Got my class
package com.test.beans;
import javax.persistence.Entity;
import org.springframework.roo.addon.entity.RooEntity;
import org.springframework.roo.addon.javabean.RooJavaBean;
import org.springframework.roo.addon.tostring.RooToString;
@Entity
@RooEntity
@RooJavaBean
@RooToString
public class EntityOne {
@Size(min = 3)
private String name;
}
Next you can create a controller with one line of tab assisted commands. It will generate a Java Spring powered bean, view files with backend (via Spring MVC) and frontend (via Dojo Toolkit) field validation, and update configuration files.
In the same way you can generate finders, configure security (via Spring Security), email, jms (ActiveMQ), Spring web flow, integration and/or selenium tests and I believe many other features to comes with next releases.
After all that, you can exit ‘Roo’ shell and type familiar Maven comments, like
mvn install or mvn package or mvn tomcat:run
Here a the list of articles with detailed Roo walkthroughs:
- http://blog.springsource.com/2009/05/01/roo-part-1/
- http://blog.springsource.com/2009/05/27/roo-part-2/
- http://blog.springsource.com/2009/06/18/roo-part-3/
- http://stsmedia.net/introducing-spring-roo/
- http://stsmedia.net/introducing-spring-roo-part-2-security-jms-email-support/
After only dozen or so tab assisted human friendly commands you get a fully functioning Java application based on modern and widely accepted technologies tailored with all the best practices in mind.
Cool as a 25 mins boiled egg. No more searching for weird languages/frameworks which promise to reduce the code base and configuration weight. Now I can stay with same well known time proven technologies and at the same time be productive and light weight with ‘Roo’.
I’d like to ask you read the articles mentioned, check back to the Spring Roo web site to get latest release and see the full list of last features available and give it a try! And be productive from now on like never before ![]()
One more thing. ‘Spring Roo’ is still a new guy on the block, so be patient a bit. It will mature rapidly. And if you don’t want to use the heavyweight Spring STS as your IDE, then just install the Eclipse AJDT plugin. This will solve compile time aspect injection and development time dependencies via JDT weaving. This way you’ll be able to access things like bean getters/setters via auto complete functionality in the eclipse.
Related posts
- Upgrading Open Source Frameworks - Part I Just recently, I created a series of proof of concepts...
- Upgrading Open Source Frameworks - Part II Upgrading Open Source Frameworks - Part II In the first...
Courtney Palit
Dan Christopherson
Dave Kurzynski
Dru Henke
Erik Gfesser
Jim LoVerde
Kevin Crosby
Matt Warren
Roman Kuzmik
Tracey Barrett
One Comment
To test out, I used ROO to do one of my pet projects: CROW..course registration over the web(it is like a hello world with me since 1997 with any new framework or technology I encounter) Have to say! Roo is the next best thing to
Was very impressed.
Roo is Maven on steroids, in a way.
It was a snap making CROW this time around…15 mins..I had it running
i agree with you 100% regarding the thoughts that run thru one’s mind when starting a new project…been there a few times myself…
The bad thing is that some college kid with rudimentary java & db knowledge could replace me as a java developer with Roo..Time to retire, I reckon