Velocity Precompiler

Velocity Precompiler Configuration

Velocity 2.0 introduced some syntax changes that require updates to existing templates.  The Velcocity Precompiler configuration enables auto correction of common 1.x patterns in templates to 2.0 syntax.  Patterns and Replacement strings are in Regular Expression syntax.  Template sources are left unchanged, however Velocity Macro files are updated with the 2.0 syntax. 

Additional patterns and replacements can be added to this properties file using the pattern.NUMBER and matching replace.NUMBER pattern.  Patterns and Replacements must be RegEx formatted and escaped / Java Properties file formatted and escaped Strings. 

If your templates have already been converted to 2.0 syntax.  You may turn off the precompiler to avoid the extra and unnecesary performance hit at assembly time by setting the autocorrect property to false. 

Configuration Location:  <InstallDir>/rxconfig/Server/

PropertyDefault ValueDescription


trueWhen true or missing, the Auto Correct feature is turned on and all patterns within this configuration file will be applied as part of a pre-compile setp before being passed to the Velocity Engine. When false, the precompile step is skipped. 



When true or missing, this feature will Auto Correct and update any  Velocity Macro (*.vm) files deployed in the <installDir>/sys_resources/vm folder or under the <installDir>/rx_resources/vm folder. Setting this property to false will prevent ao correction of macros. 



When true or missing will add a trailing space to Velocity Macro files or Templates that end with the # or $ character.  This is to work around a defect in Velocity where the parser will fail to load a template or macro file that is 100% comments. 



Searches for any strings that match "#" in template sources and replaces them with the value of replace.1


The replacement for strings in Templates that match pattern.1



Looks for any strings that match "$" in Templates and replaces that with replace.2


Replaces "$" with '$'.  



Search Templates for references to the obsolete $velocityCount variable and replaces them with $foreach.count



The replacement string for $velocityCount



Search templates for the obsolete $velocityHasNext variable



Replace $velocityHasNext with $foreach.hasNext()