Meaningless Drivel is fun!*
The moose likes Spring and the fly likes Spring roo custom add-ons Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Spring roo custom add-ons" Watch "Spring roo custom add-ons" New topic
Author

Spring roo custom add-ons

Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8904

Can author please provide more details ? what are custom stuff that we can build ?


Groovy
Ken Rimple
author
Ranch Hand

Joined: Jul 20, 2010
Posts: 63

All of Roo is an add-on. For example, the tree of projects in Roo's source code are all of the add-ons that make up the base Roo commands:



I highly encourage everyone to download the source from GitHub:

either do a git clone https://github.com/SpringSource/spring-roo.git or download the zip. Then open up some of the addon-* folders and plunk around. It's really a neat way to build a tool, but basically add-ons can be triggered two ways at least:

1) react to changes in files / events
2) execute commands issued in the Roo shell

To expose shell commands, your add-on will have a Commands class that extends CommandMarker. Each command you expose is annotated with @CliCommand - then you can set parameters, etc.

Roo add-ons are just OSGi Java code, and generally you'll do one of several things:

1. add/update/remove an .aj file (AspectJ ITD)
2. generate Java source files (but not update once generated, that's a basic rule)
3. manipulate configuration files
4. manipulate the build (pom.xml) file
etc...

So, think of Roo like a really smart project configurator that is completely pluggable and customizable, and that comes with a base set of configuration to build Spring applications. You can extend it to do anything you want.

I have four add-ons I'm building now over at http://www.rimple.com/silly-weasel-forge/ as a way to teach others to write add-ons. I'm not perfect at it yet, and have run into some interesting problems, which I've documented on the blog at rimple.com. The book has two chapters to get you started as well. They are:
- jqueryui addon (installs jQuery and jQuery UI and inserts them in load-scripts.jspx).
- site addon - configures maven's site reporting. Eventually I'll parameterize the reports and configuration
- coffeescript addon - configures a Maven coffeescript compiler that gets executed during the compile phase
- spock add-on - my favorite at the moment - lets you write Groovy Spock BDD tests against your Roo application - I'm using it to write tests against add-ons, since they aren't Spring code but OSGi Java code and need a simple test mechanism.

Ken

Ken Rimple
ken.rimple@gmail.com
Co-author, Manning Spring Roo in Action
I teach for Chariot Solutions (Spring, Maven, Hibernate, other courses). Schedule here
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Spring roo custom add-ons
 
Similar Threads
WebSphere and Ant
Default servlet context
List the running threads
Classsic Vs Simple?
a doubt on JspFragment