Documentation
¶
Index ¶
- type Config
- type Dependency
- type ID
- type License
- type Parent
- type Project
- type Properties
- type Resolver
- func (r *Resolver) AddPom(ctx context.Context, pom *Project, location file.Location)
- func (r *Resolver) FindLicenses(ctx context.Context, groupID, artifactID, version string) ([]gopom.License, error)
- func (r *Resolver) FindPom(ctx context.Context, groupID, artifactID, version string) (*Project, error)
- func (r *Resolver) ResolveDependencyID(ctx context.Context, pom *Project, dep Dependency) ID
- func (r *Resolver) ResolveID(ctx context.Context, pom *Project) ID
- func (r *Resolver) ResolveLicenses(ctx context.Context, pom *Project) ([]License, error)
- func (r *Resolver) ResolveParent(ctx context.Context, pom *Project) (*Project, error)
- func (r *Resolver) ResolveProperty(ctx context.Context, pom *Project, propertyValue *string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // UseNetwork instructs the maven resolver to use network operations to resolve maven artifacts UseNetwork bool `yaml:"use-network" json:"use-network" mapstructure:"use-network"` // Repositories are the set of remote repositories the network resolution should use Repositories []string `yaml:"maven-repositories" json:"maven-repositories" mapstructure:"maven-repositories"` // UseLocalRepository instructs the maven resolver to look in the host maven cache, usually ~/.m2/repository UseLocalRepository bool `yaml:"use-maven-local-repository" json:"use-maven-local-repository" mapstructure:"use-maven-local-repository"` // LocalRepositoryDir is an alternate directory to use to look up the local repository LocalRepositoryDir string `yaml:"maven-local-repository-dir" json:"maven-local-repository-dir" mapstructure:"maven-local-repository-dir"` // MaxParentRecursiveDepth allows for a maximum depth to use when recursively resolving parent poms and other information, 0 disables any maximum MaxParentRecursiveDepth int `yaml:"max-parent-recursive-depth" json:"max-parent-recursive-depth" mapstructure:"max-parent-recursive-depth"` }
func DefaultConfig ¶
func DefaultConfig() Config
type Dependency ¶
type Dependency = gopom.Dependency
func DirectPomDependencies ¶
func DirectPomDependencies(pom *Project) []Dependency
DirectPomDependencies returns all dependencies directly defined in a project, including all defined in profiles. This does not resolve any parent or transitive dependencies
type Properties ¶
type Properties = gopom.Properties
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
Resolver is a short-lived utility to resolve maven poms from multiple sources, including: the scanned filesystem, local maven cache directories, remote maven repositories, and the syft cache
func NewResolver ¶
NewResolver constructs a new Resolver with the given configuration. NOTE: the fileResolver is optional and if provided will be used to resolve parent poms by relative path
func (*Resolver) AddPom ¶
AddPom allows for adding known pom files with locations within the file resolver, these locations may be used while resolving parent poms by relative path
func (*Resolver) FindLicenses ¶
func (r *Resolver) FindLicenses(ctx context.Context, groupID, artifactID, version string) ([]gopom.License, error)
FindLicenses attempts to find a pom, and once found attempts to resolve licenses traversing parent poms as necessary
func (*Resolver) FindPom ¶
func (r *Resolver) FindPom(ctx context.Context, groupID, artifactID, version string) (*Project, error)
FindPom gets a pom from cache, local repository, or from a remote Maven repository depending on configuration
func (*Resolver) ResolveDependencyID ¶
ResolveDependencyID creates an ID from a dependency element in a pom, resolving information as necessary
func (*Resolver) ResolveID ¶
ResolveID creates an ID from a pom, resolving parent information as necessary
func (*Resolver) ResolveLicenses ¶
ResolveLicenses searches the pom for license, resolving and traversing parent poms if needed
func (*Resolver) ResolveParent ¶
ResolveParent resolves the parent definition, and returns a POM for the parent, which is possibly incomplete, or nil
func (*Resolver) ResolveProperty ¶
ResolveProperty gets property values by emulating maven property resolution logic, looking in the project's variables as well as supporting the project expressions like ${project.parent.groupId}. Properties which are not resolved result in empty string ""