Velocity-enabled filter for preprocessing.
VPPFilter is an Ant filter that processes its input using the Velocity Template Engine. It can be used with any filter chain-capable tasks such as Copy, LoadFile, LoadProperties, and Move.
Note that for most preprocessing uses with Copy, VPPCopy provides a handy shortcut.
VPPFilter does not currently have any parameters at this time.
config
By specifying this nested element, you can configure the Velocity Engine and Context used when preprocessing. See VPPConfig for a detailed description.
Note that there was a big change (for the better, IMHO) in Ant 1.6.x with respect to the treatment of non-builtin filters that allows them to be treated on par with builtin filters. As a result, configuration between 1.5.x and 1.6.x is different.
<!-- Ant 1.6.x and later --> <copy todir="output" overwrite="true" > <fileset dir="${src}" includes="*.html.vpp" /> <mapper type="glob" from="*.html.vpp" to="*.html" /> <filterchain> <vpp:filter/> </filterchain> </copy>
<!-- Ant 1.5.x and previous --> <copy todir="output" overwrite="true" > <fileset dir="${src}" includes="*.html.vpp" /> <mapper type="glob" from="*.html.vpp" to="*.html" /> <filterchain> <filterreader classname="foundrylogic.vpp.VPPFilter"/> </filterchain> </copy>
preprocess all files with a .html.vpp extension in the ${src}
directory to the output directory with a .html extension.
<!-- Ant 1.6.x and later (nested config) --> <copy todir="output" overwrite="true" > <fileset dir="${src}" includes="*.html.vpp" /> <mapper type="glob" from="*.html.vpp" to="*.html" /> <filterchain> <vpp:filter xmlns:vpp="antlib:foundrylogic.vpp" > <config> <context> <property key="foo" value="bar"/> </context> </config> </vpp:filter> </filterchain> </copy>
<!-- Ant 1.6.x and later (standalone config) --> <vpp:config id="vppconfig0"> <context> <property key="foo" value="bar"/> </context> </vpp:config> <copy todir="output" overwrite="true" > <fileset dir="${src}" includes="*.html.vpp" /> <mapper type="glob" from="*.html.vpp" to="*.html" /> <filterchain> <vpp:filter xmlns:vpp="antlib:foundrylogic.vpp" > <config refid="vppconfig0"/> </vpp:filter> </filterchain> </copy>
<!-- Ant 1.5.x and previous --> <vpp:config id="vppconfig0"> <context> <property key="foo" value="bar"/> </context> </vpp:config> <copy todir="output" overwrite="true" > <fileset dir="${src}" includes="*.html.vpp" /> <mapper type="glob" from="*.html.vpp" to="*.html" /> <filterchain> <filterreader classname="foundrylogic.vpp.VPPFilter"> <param type="config" value="vppconfig0" /> </filterreader> </filterchain> </copy>
preprocess all files with a .html.vpp extension in the ${src}
directory to the output directory with a .html extension.