Class IvyModuleComponentResolver

  • All Implemented Interfaces:
    java.lang.Cloneable, ComponentResolver

    public class IvyModuleComponentResolver
    extends org.apache.tools.ant.ProjectComponent
    implements ComponentResolver
    Resolver that populates a Component from Ivy module data.

    Assumes the Ivy file has already been resolved (i.e., the project has run ivy:resolve already). Uses the Ivy engine to resolve dependencies from the Ivy cache.

    Strongly influenced by Ivy's dependencytree task.

    Since:
    CycloneDX Antlib 0.2
    • Field Summary

      • Fields inherited from class org.apache.tools.ant.ProjectComponent

        description, location, project
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addConfiguredTemplateComponent​(Component c)
      Adds a nested template component.
      java.util.Collection<Component> resolve​(Component component)
      Resolves the Ivy module and populates the component with its data.
      void setConf​(java.lang.String conf)
      Sets the configurations to include in the SBOM.
      void setExternalConf​(java.lang.String externalConf)
      Marks configurations as external.
      void setOptionalConf​(java.lang.String optionalConf)
      Marks configurations as optional.
      void setPattern​(java.lang.String pattern)
      The retrieve pattern used for retrieving the dependency artifacts.
      void setResolveId​(java.lang.String resolveId)
      Sets the id which was used for a previous resolve.
      void setSettingsRef​(org.apache.tools.ant.types.Reference ref)
      Sets a reference is a different Ivy settings file than the default shall be used.
      • Methods inherited from class org.apache.tools.ant.ProjectComponent

        clone, getDescription, getLocation, getProject, log, log, setDescription, setLocation, setProject
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • IvyModuleComponentResolver

        public IvyModuleComponentResolver()
    • Method Detail

      • setConf

        public void setConf​(java.lang.String conf)
        Sets the configurations to include in the SBOM.

        Defaults to the configurations resolved by the last resolve call, or * if no resolve was explicitly called

        Parameters:
        conf - comma separated list of the configurations to retrieve or *.
      • setResolveId

        public void setResolveId​(java.lang.String resolveId)
        Sets the id which was used for a previous resolve.

        Defaults to [org].[module].

        Parameters:
        resolveId - id which was used for a previous resolve
      • setSettingsRef

        public void setSettingsRef​(org.apache.tools.ant.types.Reference ref)
        Sets a reference is a different Ivy settings file than the default shall be used.

        Defaults to ivy.instance.

        Parameters:
        ref - A reference to Ivy settings that must be used by this component
      • setOptionalConf

        public void setOptionalConf​(java.lang.String optionalConf)
        Marks configurations as optional.

        Any module that is included in the SBOM because it is required by on of the configurations given in setConf(java.lang.String) and only is included because of configurations listed here is marked optional. Including configurations that are not part of setConf(java.lang.String) doesn't have any effect. * is no supported. The default is to have no optional components.

        Parameters:
        optionalConf - comma separated list of the configurations to mark optional.
      • setExternalConf

        public void setExternalConf​(java.lang.String externalConf)
        Marks configurations as external.

        Any module that is included in the SBOM because it is required by on of the configurations given in setConf(java.lang.String) and only is included because of configurations listed here is marked external. Including configurations that are not part of setConf(java.lang.String) doesn't have any effect. * is no supported. The default is to have no external components.

        Parameters:
        externalConf - comma separated list of the configurations to mark external.
      • setPattern

        public void setPattern​(java.lang.String pattern)
        The retrieve pattern used for retrieving the dependency artifacts.

        Defaults to ${ivy.retrieve.pattern}.

        Parameters:
        pattern - retrieve pattern used
      • addConfiguredTemplateComponent

        public void addConfiguredTemplateComponent​(Component c)
        Adds a nested template component.
        Parameters:
        c - nested template component
      • resolve

        public java.util.Collection<Component> resolve​(Component component)
                                                throws java.io.IOException,
                                                       org.apache.tools.ant.BuildException
        Resolves the Ivy module and populates the component with its data.
        Specified by:
        resolve in interface ComponentResolver
        Parameters:
        component - the component to populate
        Returns:
        additional components that are (transitive) dependencies of this component
        Throws:
        java.io.IOException - if resolution fails
        org.apache.tools.ant.BuildException