Configure Velocity to fail on undefined $variable

java, template-engine, velocity

Solution

In Velocity 1.6 you can add the following property to your velocity.properties

runtime.references.strict = true

Edit: Full list of configuration is available here: http://velocity.apache.org/engine/devel/configuration.html

Problem

Can Velocity be configure to fail (i.e. throw an Exception) when a $var is undefined. Such a "fail-fast" strategy would help in our testing cycles.

Original source