I can’t get NVelocity to initialize. I’m not trying to do anything complicated, so it’s just fine if it initializes at the defaults, but it won’t even do that.
This:
VelocityEngine velocity = new VelocityEngine(); ExtendedProperties props = new ExtendedProperties(); velocity.Init(props);
Results in: ‘It appears that no class was specified as the ResourceManager…’
So does this:
VelocityEngine velocity = new VelocityEngine(); velocity.Init();
I can find precious little documentation on what the properties should be, nor how to get it to initialize with the simple defaults. Can anyone point to a resource?
A lot of pages point back to this page:
http://www.castleproject.org/others/nvelocity/usingit.html
But this page skips over the (seemingly) most important point — how to set the properties and what to set them to.
I just want to load a simple template from a file.
Here’s what I found out —
I was using the original NVelocity library, which hasn’t had an update since 2003. I think it’s a dead project.
I switched to the Castle Project version, and it’s much easier — in fact, it runs much like the examples on the page I linked to. It seems to set intelligent defaults for properties. I can initialize it without any properties set, but the template directory defaults to ‘.’, so I generally set that one (do it before running ‘init’).
To get the correct DLL, you need to download the latest NVelocity release (as of this writing it’s 1.1).
Castle Project Download Page