Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Spring roo custom add-ons

 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can author please provide more details ? what are custom stuff that we can build ?
 
Ken Rimple
author
Ranch Hand
Posts: 63
Mac OS X Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic