File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Spring roo custom add-ons" Watch "Spring roo custom add-ons" New topic

Spring roo custom add-ons

Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8927

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

Ken Rimple
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 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

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 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 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 Rimple
Co-author, Manning Spring Roo in Action
I teach for Chariot Solutions (Spring, Maven, Hibernate, other courses). Schedule here
I agree. Here's the link:
subject: Spring roo custom add-ons
It's not a secret anymore!