Substitute for the Copy task with integrated preprocessing.
VPPCopy is the simplest way to preprocess files. Specified just like like the Copy task, VPPCopy treats its source files as Velocity templates and writes the preprocessed output to the specified destination. In essence, VPPCopy is simply a short cut for a Copy task defined with a single VPPFilter.
In addition, VPPCopy also inserts an instance of VPPTool into the Velocity Context that allows you to access information about the source and destination files and encodings used for each file copied. It can be accessed through the key,vpp
.
VPPCopy supports all of Copy's parameters and does not add any additional parameters at this time.
In addition to all of Copy's parameters, VPPCopy also supports all of Copy's parameters specified as nested elements, including additional filters which are processed subsequent to preprocessing via VPPFilter. VPPCopy additionally supports the following parameters specfied as nested elements:
config
By specifying this nested element, you can configure the Velocity Engine and Context used when preprocessing. See VPPConfig for a detailed description.
Note: the following examples assume that VPPCopy is being used as
an antlib, hence the tasks use the vpp
namespace.
If not using as an antlib, then simply omit the ':' character and the
xmlns attribute.
<vpp:copy todir="output" overwrite="true" xmlns:vpp="antlib:foundrylogic.vpp" > <fileset dir="${src}" includes="*.html.vpp" /> <mapper type="glob" from="*.html.vpp" to="*.html" /> </vpp:copy>
preprocess all files with a .html.vpp extension in the ${src}
directory to the output directory with a .html extnension.