Sep 25th, 2009, 12:23 AM
Spring roo dependency
I worked on a sample spring roo refererence implementation project. I have a question regarding spring roo dependency (coupling of ROO to the application). Although I read the SpringSource blogs that it is not so, what I saw with the generated code was reliance on ROO APIs. Is there any way, I can get rid of the ROO dependency or do I need to learn to live with it?
Sep 25th, 2009, 08:15 PM
Roo has absolutely zero runtime dependencies on your project. If you "mvn package" your project, you'll see the resulting WAR doesn't even have a Roo JAR within the WEB-INF/lib and nor do the *.class files contain references to the Roo annotations (this is because pom.xml declares the roo-annotations.jar as a compile-time dependency only).
The Roo annotation usage is source level only. As such you need roo-annotations.jar in your compile-time classpath so the compiler regards the source code as legal Java code.
If you want to get rid of Roo from your project (eg perhaps you've decided to just use Roo to kick-off a project using best practice) you can easily use the "push in refactoring" support. This will move all the ITD content into the corresponding .java files. You can then easily remove the @Roo* annotation usage from your .java files and remove the roo-annotations.jar from your build-time classpath as well.
Please note that roo-annotations.jar only has standard source-level annotations inside. It has absolutely no executable code. And as explained above, it never appears at runtime and is easily removed should even that minimal exposure be of concern.