Now that I have your attention 🙂

Velocity is a fine product that delivers its promise, but it has a few

  • Velocity is pretty much a dead project.  There has hardly been any
    activity in over a year and nobody seems to be interested in taking over. 
    The good news is that from my experience, Velocity is relatively bug free,
    but it doesn’t bode well for its ability to evolve with the increasing
    demand of modern Java computing.
  • It comes with some annoying dependencies, such as log4j or commons. 
    I am not criticizing the quality of these two packages but Velocity has a
    rude way of instantiating its loggers that recently gave me quite a
    headache.  On a related note, if you intend to publish a framework,
    please think twice before adding dependencies on packages that your users
    might be using in their own code base.  To add insult to injury, log4j
    happens to have a perfectly decent equivalent in the JDK itself. 
    Granted, java.util.logger isn’t as powerful as log4j, but in this particular
    case, I see no reason why Velocity is trying to impose its own logger on
    pour souls like me who only need a simple generator framework.
  • Finally, Velocity offers very little control on the indentation and
    shape of generated files and I haven’t found any satisfying way to solve
    that problem.

With that in mind, I started thinking about a replacement.  The Velocity
API is simple and easy to understand, but I had no desire to implement yet
another expression language.  The solution quickly imposed itself to me: 

Not only is Groovy a cool language that borrows features from two of my
favorite languages, Java and Ruby, it’s also extremely easy to embed in a Java

With that in mind, it took me just a few hours to put together this quick
prototype of a product reusing the Velocity API but using Groovy as its
expression language.  The good news is that the dependency is now limited
to one jar file:  groovy.jar.

I called this product Canvas and you can read more about it on its
home page.

Also, I’d like to take this opportunity to hereby claim the title of the
smallest framework ever:  Canvas only has three classes.  You can’t
get more lightweight than that!