Package org.cyclonedx.maven
Class BaseCycloneDxMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.cyclonedx.maven.BaseCycloneDxMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
CycloneDxMojo,CycloneDxPackageMojo
public abstract class BaseCycloneDxMojo extends org.apache.maven.plugin.AbstractMojo
-
-
Field Summary
Fields Modifier and Type Field Description protected booleandetectUnusedForOptionalScopeUse the original mechanism for determining whether a component has OPTIONAL or REQUIRED scope, relying on bytecode analysis of the compiled classes instead of the Maven dependency declaration of optional.protected static StringMESSAGE_ATTACHING_BOMprotected static StringMESSAGE_CREATING_BOMprotected static StringMESSAGE_RESOLVING_AGGREGATED_DEPSprotected static StringMESSAGE_RESOLVING_DEPSVarious messages sent to console.protected static StringMESSAGE_VALIDATION_FAILUREprotected static StringMESSAGE_WRITING_BOM
-
Constructor Summary
Constructors Constructor Description BaseCycloneDxMojo()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected org.cyclonedx.model.Componentconvert(org.apache.maven.artifact.Artifact artifact)voidexecute()protected ProjectDependenciesConverter.BomDependenciesextractBOMDependencies(org.apache.maven.project.MavenProject mavenProject)protected abstract StringextractComponentsAndDependencies(Set<String> topLevelComponents, Map<String,org.cyclonedx.model.Component> components, Map<String,org.cyclonedx.model.Dependency> dependencies)Analyze the current Maven project to extract the BOM components list and their dependencies.protected StringgeneratePackageUrl(org.apache.maven.artifact.Artifact artifact)protected org.apache.maven.project.MavenProjectgetProject()Returns a reference to the current project.protected voidlogAdditionalParameters()protected voidlogParameters()protected voidpopulateComponents(Set<String> topLevelComponents, Map<String,org.cyclonedx.model.Component> components, Map<String,org.apache.maven.artifact.Artifact> artifacts, org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalysis dependencyAnalysis)protected org.cyclonedx.CycloneDxSchema.VersionschemaVersion()Resolves the CycloneDX schema the mojo has been requested to use.
-
-
-
Field Detail
-
detectUnusedForOptionalScope
@Parameter(property="detectUnusedForOptionalScope", defaultValue="false") protected boolean detectUnusedForOptionalScopeUse the original mechanism for determining whether a component has OPTIONAL or REQUIRED scope, relying on bytecode analysis of the compiled classes instead of the Maven dependency declaration of optional.- Since:
- 2.7.9
-
MESSAGE_RESOLVING_DEPS
protected static final String MESSAGE_RESOLVING_DEPS
Various messages sent to console.- See Also:
- Constant Field Values
-
MESSAGE_RESOLVING_AGGREGATED_DEPS
protected static final String MESSAGE_RESOLVING_AGGREGATED_DEPS
- See Also:
- Constant Field Values
-
MESSAGE_CREATING_BOM
protected static final String MESSAGE_CREATING_BOM
- See Also:
- Constant Field Values
-
MESSAGE_WRITING_BOM
protected static final String MESSAGE_WRITING_BOM
- See Also:
- Constant Field Values
-
MESSAGE_ATTACHING_BOM
protected static final String MESSAGE_ATTACHING_BOM
- See Also:
- Constant Field Values
-
MESSAGE_VALIDATION_FAILURE
protected static final String MESSAGE_VALIDATION_FAILURE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getProject
protected org.apache.maven.project.MavenProject getProject()
Returns a reference to the current project.- Returns:
- returns a reference to the current project
-
generatePackageUrl
protected String generatePackageUrl(org.apache.maven.artifact.Artifact artifact)
-
convert
protected org.cyclonedx.model.Component convert(org.apache.maven.artifact.Artifact artifact)
-
extractComponentsAndDependencies
protected abstract String extractComponentsAndDependencies(Set<String> topLevelComponents, Map<String,org.cyclonedx.model.Component> components, Map<String,org.cyclonedx.model.Dependency> dependencies) throws org.apache.maven.plugin.MojoExecutionException
Analyze the current Maven project to extract the BOM components list and their dependencies.- Parameters:
topLevelComponents- the PURLs for all top level componentscomponents- the components map to filldependencies- the dependencies map to fill- Returns:
- the name of the analysis done to store as a BOM, or
nullto not save result. - Throws:
org.apache.maven.plugin.MojoExecutionException- something weird happened...
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
extractBOMDependencies
protected ProjectDependenciesConverter.BomDependencies extractBOMDependencies(org.apache.maven.project.MavenProject mavenProject) throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
schemaVersion
protected org.cyclonedx.CycloneDxSchema.Version schemaVersion()
Resolves the CycloneDX schema the mojo has been requested to use.- Returns:
- the CycloneDX schema to use
-
logAdditionalParameters
protected void logAdditionalParameters()
-
logParameters
protected void logParameters()
-
-