Ken Rimple heads Chariot Solutions' training and mentoring programs, and has developed and/or delivered courseware and seminars in a variety of technologies such as Maven, OSGi, Groovy, Grails and Spring. Throughout his career, Ken has always made it a priority to teach others what he has learned. Ken has served as the technical co-chair of both the Fall Forecast 2008 Cloud Computing Conference and the 2009 - 2012 Emerging Technologies for the Enterprise conferences. He hosts a popular podcast, the Chariot TechCast, and has led or participated in projects written in Java since Java 1.0.2. Ken taught the first Philadelphia-area Sun Introduction to Java course in the late 1990s. He is the co-author (along with Srini Penchikala) of Spring Roo in Action for Manning Publications. He is also an avid photographer and jazz drummer. Ken is a DZone MVB and is not an employee of DZone and has posted 35 posts at DZone. You can read more from them at their website. View Full User Profile

Hacking The 'Roo... Removing The Default Web Plugins

  • submit to reddit

Let's say you love the productivity of Roo up to a point, but that point happens to be the web. Unfortunately, the default Spring MVC patterns installed in a Roo web app are pretty heavyweight - adding localization, tiles, tags, jspx, etc...

If you ever set up and then backed-out a Roo configuration for the web, and then did the wrong thing and found it regenerated the default web site scaffold, you may have sighed under your breath that you just wish Roo didn't do that.

Well, you have an option. I'd say it's rather voodoo, but if you want to get prototyping in some web-based applications and just make a simple Spring MVC front-end, but don't want to get Roo involved in anything above, say, the service tier, here's what you can do:

  • Make a custom Roo installation directory
  • Expand Roo
  • remove the bundles for web, webmvc, web-json, gwt, jsf, selenium (and maybe one or two more I can't remember)
  • remove the cache directory from Roo (it copies the deployed add-ons into this cache as part of the Equinox OSGi container).
  • start up Roo, and see if it sends any OSGi errors your way. If it does, you've forgotten to remove a bundle. Try again - shut down the shell, follow the removal step, clear the cache directory, and restart.

There you are. Now, you can enjoy using Roo for the Aspect-J ITDs, and to make modeling data easier, but if you are simply using Spring MVC for a RESTful front-end, now Roo doesn't get in your way anymore.

You can always link your shell script for this version of roo to something like /usr/bin/roo-lite.

Happy Roo'ing.


Published at DZone with permission of Ken Rimple, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)


Lajos Papp replied on Fri, 2013/10/04 - 4:54am

Hi Ken,

As you mentioned, spring Roo is running in an osgi container (equinox). So you can have the exact same effect (switching off plugins) by just stopping the bundles.

osgi ps
[  40] [Active     ]... - toString (1.2.3.RELEASE)
[  41] [Active     ]... - Web - Flow (1.2.3.RELEASE)
[  42] [Active     ]... - Web MVC Controller (1.2.3.RELEASE)
[  43] [Active     ]... - Web MVC Embedded Extensions (1.2.3.RELEASE)
[  44] [Active     ]... - Web MVC JSP View (1.2.3.RELEASE)
[  45] [Active     ]... - Web Selenium Test Generator (1.2.3.RELEASE)
[  46] [Active     ]... - Classpath (1.2.3.RELEASE)
[  47] [Active     ]... - Classpath (JavaParser Implementation) (1.2.3.RELEASE)
osgi framework command stop 44
[  42] [Active     ]... - Web MVC Controller (1.2.3.RELEASE)
[  43] [Active     ]... - Web MVC Embedded Extensions (1.2.3.RELEASE)
[  44] [Resolved   ]... - Web MVC JSP View (1.2.3.RELEASE)
[  45] [Active     ]... - Web Selenium Test Generator (1.2.3.RELEASE)
[  46] [Active     ]... - Classpath (1.2.3.RELEASE)

That way you switched off the Jsp generation. I tested it with the pizzashop sample, and got only the controllers/JPA/aspect files but 0 jps.

The good thing about this alternative, that the plugin deactivation is only effective for the actual roo shell. So once you restart all the default plugins are active again.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.