Package org.apache.ant.cyclonedx
Class ComponentBomTask
- java.lang.Object
-
- org.apache.tools.ant.ProjectComponent
-
- org.apache.tools.ant.Task
-
- org.apache.ant.cyclonedx.ComponentBomTask
-
- All Implemented Interfaces:
java.lang.Cloneable
public class ComponentBomTask extends org.apache.tools.ant.TaskTask that creates CycloneDX BOMs for a single component.
-
-
Constructor Summary
Constructors Constructor Description ComponentBomTask()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAdditionalComponent(Component c)Adds another component to the SBOM.voidaddConfiguredLicense(License l)Adds a license to the SBOM's metadata.voidaddToolComponent(Component c)Adds component to be added to the metadata.tools section of the SBOM.ComponentcreateComponent()Sets the component for the SBOM.OrganizationcreateManufacturer()Sets the manufacturer of the SBOM.org.apache.tools.ant.types.resources.UnioncreatePureFileComponents()Accepts arbitrary file-system only resources that will be added as components of type file.OrganizationcreateSupplier()Sets the supplier of the SBOM.voidexecute()voidsetBomName(java.lang.String bomName)Sets the base name of the generated BOM.voidsetFormat(OutputFormat format)Which serialization format of CycloneDX SBOM to use.voidsetOutputDirectory(java.io.File f)Sets the output directory for the generated SBOM.voidsetSerialNumber(java.lang.String serialNumber)Specifies the serial number of the BOM.voidsetSpecVersion(SpecVersion specVersion)Specifies the CycloneDX version to use.voidsetUseComponentManufacturer(boolean useComponentManufacturer)Whether to use the manufacturer of the main component as manufacturer for the BOM as well.voidsetUseComponentSupplier(boolean useComponentSupplier)Whether to use the supplier of the main component as supplier for the BOM as well.-
Methods inherited from class org.apache.tools.ant.Task
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
-
-
-
-
Method Detail
-
setSpecVersion
public void setSpecVersion(SpecVersion specVersion)
Specifies the CycloneDX version to use.Defaults to 1.7.
- Parameters:
specVersion- specification version
-
setSerialNumber
public void setSerialNumber(java.lang.String serialNumber)
Specifies the serial number of the BOM.The default behavior is to generate a new random serial number for each BOM generated like the spec recommends. This default behavior can be specified explicitly be setting the value to "random".
- Parameters:
serialNumber- serial number for the SBOM. Must be a valid RFC 4122 UUID URN or the literal String "random".- Since:
- CycloneDX Antlib 0.2
-
setFormat
public void setFormat(OutputFormat format)
Which serialization format of CycloneDX SBOM to use.- Parameters:
format- output format
-
setBomName
public void setBomName(java.lang.String bomName)
Sets the base name of the generated BOM.The file name will be the base name plus the extension of the {@see #setFormat format}.
- Parameters:
bomName- base name of generated file
-
setOutputDirectory
public void setOutputDirectory(java.io.File f)
Sets the output directory for the generated SBOM.- Parameters:
f- output directory
-
setUseComponentSupplier
public void setUseComponentSupplier(boolean useComponentSupplier)
Whether to use the supplier of the main component as supplier for the BOM as well.- Parameters:
useComponentSupplier- whether to use supplier of component for the BOM
-
setUseComponentManufacturer
public void setUseComponentManufacturer(boolean useComponentManufacturer)
Whether to use the manufacturer of the main component as manufacturer for the BOM as well.- Parameters:
useComponentManufacturer- whether to use manufacturer of component for the BOM
-
createComponent
public Component createComponent()
Sets the component for the SBOM.- Returns:
- container for main component
-
createManufacturer
public Organization createManufacturer()
Sets the manufacturer of the SBOM.At most one manufacturer can be set.
- Returns:
- manufaturer of SBOM
-
createSupplier
public Organization createSupplier()
Sets the supplier of the SBOM.At most one supplier can be set.
- Returns:
- supplier of SBOM
-
addConfiguredLicense
public void addConfiguredLicense(License l)
Adds a license to the SBOM's metadata.- Parameters:
l- SBOM's license
-
addAdditionalComponent
public void addAdditionalComponent(Component c)
Adds another component to the SBOM.- Parameters:
c- component to be added to SBOM
-
addToolComponent
public void addToolComponent(Component c)
Adds component to be added to the metadata.tools section of the SBOM.This is meant to be used by tools that have also taken part in the generation of this SBOM.
- Parameters:
c- component to be added to tools
-
createPureFileComponents
public org.apache.tools.ant.types.resources.Union createPureFileComponents()
Accepts arbitrary file-system only resources that will be added as components of type file.- Returns:
- container for pure file components
-
execute
public void execute()
- Overrides:
executein classorg.apache.tools.ant.Task
-
-