Velocity vs. FreeMarker

52,771

Solution 1

When this quesiton was asked, velocity wasn't really under active development any more and Freemarker was.

Freemarker is also a lot more flexible, in my experience.

Solution 2

The goals for the projects are different.

Velocity's goal is to keep templates as simple as possible, to help maintain a segregation between logic and presentation, so you don't slide down the slippery slope of sticking code in templates. Sometimes this is the right thing. Of course, sometimes being able to wire complicated logic directly into templates is the right thing.

Velocity doesn't get frequently rev'd, but that doesn't mean it's not under active development. The user community is large, the code is fast and stable, the syntax is basically fixed. Over the last several years Freemarker has undergone churn on the template syntax and api side. Sometimes it's nice to leave well enough alone. Again, depends on what you're looking for.

Freemarker's documentation is much more extensive- and it's a much more complicated piece of software.

Many of the use cases for Freemarker boil down to wanting a complex templating workflow and not wanting a compilation step. In recent years, rather than struggle through this with Java I've just been using Python or Ruby instead.

Solution 3

Use Freemarker if you can :

  • Still in active development like @skaffman said
  • Good documentation, better than Velocity IMHO
  • Provided as alternative templating language in many web frameworks
  • Less dependencies than Velocity
  • More complete than the raw Velocity without extensions.
  • Also see the link provided by @leonm

Solution 4

They try to differentiate themselves from time to time (example).

I've worked extensively with both and from my perspective they're very similar. There are just so many features that you can build into a templating language, the rest is just fluff.

Solution 5

There are two published books about Velocity:

and other books that have chapters about it too. So, that much about FreeMarker having more or better docs :).

Share:
52,771
flybywire
Author by

flybywire

Updated on July 29, 2020

Comments

  • flybywire
    flybywire almost 4 years

    Velocity or FreeMarker?

    They look pretty much the same, even the syntax?

    What to use? Or when to use what?

  • Harini
    Harini over 14 years
    Some of those are obsolete right now(See : This list is originally based on a comparison with Velocity 1.2) since Velocity reached 1.6. In terms of performance, I didn't see a valid test to see which one performs better.
  • Scott
    Scott over 12 years
    Considering that the list is based on a Velocity version nearing a decade in the past, it's a disgrace to the freemarker community that they have not updated it. Velocity is at 1.7 now and most of that list is false.
  • Scott
    Scott over 12 years
    There have been certain people in the Freemarker community spreading the myth of Velocity inactivity for nearly 7 years now. In that time, Velocity has made nigh on a dozen releases (including point releases and VelocityTools releases).
  • fijiaaron
    fijiaaron over 12 years
    If a template system is still under active development 10+ years in, you might want to look for something a bit more stable.
  • Jay
    Jay over 12 years
    The fact that something is under constant "development" is really not a positive thing.
  • Rudy
    Rudy about 12 years
    and everybody is changing. :)
  • Jherico
    Jherico about 10 years
    While it does look like Velocity seems to have lost steam development-wise (I'm going with FTL on the basis of this response), the last stable release date of something isn't always the best measure of it's value. HTTP never left 2.0 and MIME never left 1.0. Granted, those are specs, not software, but I think there's likely some valuable tools out there that simply became mature.
  • ddekany
    ddekany over 8 years
    I'm the current maintainer of FreeMarker (I'm not the original author, BTW). Before 2.3.0 (mid 2004), it's the dark ages, chaos. Since mid 2004 (2.3.0) the releases are backward compatible, and in 2016 FreeMarker is at 2.3.23. Some new features were added that deprecated old ones, especially in the last years, but after so many years, thing come up, expectations change, and the initial interception was far from perfect. It's only now, after 12 years after 2.3.0, that a new generation FreeMarker is considered (in a different package). If you don't get wiser after 12 years, you know...
  • Brett Ryan
    Brett Ryan over 7 years
    I totally agree with this point. When a choice arises I will often choose Velocity as the features of Freemaker are unnecessary.
  • Dherik
    Dherik over 6 years
    Velocity is alive again. New version 2.0 stable released in August 2017.
  • Koshinae
    Koshinae over 6 years
    This answer is completely false.
  • Ariel
    Ariel about 5 years
    velocity.apache.org/news.html#engine21 Velocity Engine 2.1 released (Sunday, 31 March 2019) Velocity Tools 3.0 released (Tuesday, 9 October 2018)
  • jfrohn
    jfrohn over 4 years
    They just released a new version on February 2. 2020:velocity.apache.org/news.html#engine22 This comment should be removed.