since CycloneDX Antlib 0.2
This is a resource collection very similar to Ant's
built-in mappedresources
in that it decorates an existing resource collection by mapping
the resource names. Unlike mappedresources it can
only be used for file-system resources and allows tasks to
directly access the underlying files.
When used with arbitrary tasks in Ant it is very likely the
task will directly go to the files and completely ignore the
mapped name, so it is not meant to be used as a general purpose
resource collection. It's primary purpose is to be used inside
of componentbom's pureFileComponents
child. pureFileComponents are commonly used to list
the contents of zip or tar archives that have
used zipfileset's
or tarfileset's prefix attribute. This
resource collection allows the components to be listed without
creating temporary folders holding the original contents with
adapted names.
Apart from Ant's id/refid this element doesn't
support any attributes.
Specifies the files that make up the resource collection.
A
single mapper
can be used to map names. Either by using a
nested mapper element or by a built-in mapper
type.
If no mapper has been given (which doesn't make any sense, honestly), an identity mapper will be used.
The following task adds all files contained in
the src directory to the SBOM as file resources,
calculating hashes from the file contents but prefixing all file
names by the value of the prefix property.:
<cdx:componentbom
...
xmlns:cdx="antlib:org.apache.ant.cyclonedx">
...
<pureFileComponents>
<cdx:fsonlymappedresources>
<fileset dir="src"/>
<globmapper from="*" to="${prefix}/*"/>
</cdx:fsonlymappedresources>
</pureFileComponents>
</cdx:componentbom>