public abstract class BaseCycloneDxMojo
extends org.apache.maven.plugin.AbstractMojo
implements org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable
| Modifier and Type | Field and Description |
|---|---|
protected org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalyzer |
dependencyAnalyzer
DependencyAnalyzer
|
protected String[] |
excludeArtifactId |
protected Boolean |
excludeTestProject |
protected static String |
MESSAGE_CALCULATING_HASHES |
protected static String |
MESSAGE_CREATING_BOM |
protected static String |
MESSAGE_RESOLVING_DEPS
Various messages sent to console.
|
protected static String |
MESSAGE_VALIDATING_BOM |
protected static String |
MESSAGE_VALIDATION_FAILURE |
protected static String |
MESSAGE_WRITING_BOM |
| Constructor and Description |
|---|
BaseCycloneDxMojo() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addMavenProjectsAsDependencies(List<org.apache.maven.project.MavenProject> reactorProjects,
Set<org.cyclonedx.model.Dependency> dependencies) |
protected Set<org.cyclonedx.model.Dependency> |
buildDependencyGraph(Set<String> componentRefs,
org.apache.maven.project.MavenProject mavenProject) |
void |
contextualize(org.codehaus.plexus.context.Context theContext) |
protected org.cyclonedx.model.Component |
convert(org.apache.maven.artifact.Artifact artifact)
Converts a Maven artifact (dependency or transitive dependency) into a
CycloneDX component./
|
protected org.cyclonedx.model.Metadata |
convert(org.apache.maven.project.MavenProject project)
Converts a MavenProject into a Metadata object.
|
protected org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalyzer |
createProjectDependencyAnalyzer() |
protected void |
execute(Set<org.cyclonedx.model.Component> components,
Set<org.cyclonedx.model.Dependency> dependencies,
org.apache.maven.project.MavenProject mavenProject) |
protected org.cyclonedx.model.Component.Scope |
getComponentScope(org.cyclonedx.model.Component component,
org.apache.maven.artifact.Artifact artifact,
org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalysis dependencyAnalysis)
Method to identify component scope based on dependency analysis
|
String[] |
getExcludeArtifactId()
Returns if excluded ArtifactId are defined.
|
protected Boolean |
getExcludeTestProject()
Returns if project artifactId with the word test should be excluded in bom.
|
String[] |
getExcludeTypes()
Returns if excluded types are defined.
|
Boolean |
getIncludeBomSerialNumber()
Returns if the resulting BOM should contain a unique serial number.
|
protected Boolean |
getIncludeCompileScope()
Returns if compile scoped artifacts should be included in bom.
|
Boolean |
getIncludeLicenseText()
Returns if license text should be included in bom.
|
protected Boolean |
getIncludeProvidedScope()
Returns if provided scoped artifacts should be included in bom.
|
protected Boolean |
getIncludeRuntimeScope()
Returns if runtime scoped artifacts should be included in bom.
|
protected Boolean |
getIncludeSystemScope()
Returns if system scoped artifacts should be included in bom.
|
protected Boolean |
getIncludeTestScope()
Returns if test scoped artifacts should be included in bom.
|
String |
getOutputFormat()
Returns the CycloneDX output format that should be generated.
|
String |
getOutputName()
Returns the CycloneDX output name that should be generated.
|
protected org.apache.maven.project.MavenProject |
getProject()
Returns a reference to the current project.
|
protected List<org.apache.maven.project.MavenProject> |
getReactorProjects()
Returns the list of Maven Projects in this build.
|
String |
getSchemaVersion()
Returns the CycloneDX schema version the BOM will comply with.
|
org.apache.maven.execution.MavenSession |
getSession() |
protected Boolean |
getSkip()
Returns if CycloneDX execution should be skipped.
|
protected void |
logParameters() |
protected org.cyclonedx.CycloneDxSchema.Version |
schemaVersion()
Resolves the CycloneDX schema the mojo has been requested to use.
|
protected boolean |
shouldInclude(org.apache.maven.artifact.Artifact artifact) |
getLog, getPluginContext, setLog, setPluginContext@Parameter(property="excludeArtifactId",
required=false)
protected String[] excludeArtifactId
@Parameter(property="excludeTestProject",
defaultValue="false",
required=false)
protected Boolean excludeTestProject
protected static final String MESSAGE_RESOLVING_DEPS
protected static final String MESSAGE_CREATING_BOM
protected static final String MESSAGE_CALCULATING_HASHES
protected static final String MESSAGE_WRITING_BOM
protected static final String MESSAGE_VALIDATING_BOM
protected static final String MESSAGE_VALIDATION_FAILURE
protected org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalyzer dependencyAnalyzer
public org.apache.maven.execution.MavenSession getSession()
protected org.apache.maven.project.MavenProject getProject()
@Component MavenProject project; defined then the abstract
class (i.e. this class) will not have access to the current project (just
the way Maven works with the binding).protected List<org.apache.maven.project.MavenProject> getReactorProjects()
public String getSchemaVersion()
public String getOutputFormat()
public String getOutputName()
public Boolean getIncludeBomSerialNumber()
protected Boolean getIncludeCompileScope()
protected Boolean getIncludeProvidedScope()
protected Boolean getIncludeRuntimeScope()
protected Boolean getIncludeTestScope()
protected Boolean getIncludeSystemScope()
public Boolean getIncludeLicenseText()
public String[] getExcludeTypes()
public String[] getExcludeArtifactId()
protected Boolean getExcludeTestProject()
protected Boolean getSkip()
protected boolean shouldInclude(org.apache.maven.artifact.Artifact artifact)
protected org.cyclonedx.model.Metadata convert(org.apache.maven.project.MavenProject project)
project - the MavenProject to convertprotected org.cyclonedx.model.Component convert(org.apache.maven.artifact.Artifact artifact)
artifact - the artifact to convertprotected void execute(Set<org.cyclonedx.model.Component> components, Set<org.cyclonedx.model.Dependency> dependencies, org.apache.maven.project.MavenProject mavenProject) throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionExceptionprotected org.cyclonedx.CycloneDxSchema.Version schemaVersion()
protected Set<org.cyclonedx.model.Dependency> buildDependencyGraph(Set<String> componentRefs, org.apache.maven.project.MavenProject mavenProject) throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionExceptionprotected void addMavenProjectsAsDependencies(List<org.apache.maven.project.MavenProject> reactorProjects, Set<org.cyclonedx.model.Dependency> dependencies)
protected void logParameters()
public void contextualize(org.codehaus.plexus.context.Context theContext)
contextualize in interface org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizableprotected org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalyzer createProjectDependencyAnalyzer()
throws org.apache.maven.plugin.MojoExecutionException
ProjectDependencyAnalyzerorg.apache.maven.plugin.MojoExecutionException - in case of an error.protected org.cyclonedx.model.Component.Scope getComponentScope(org.cyclonedx.model.Component component,
org.apache.maven.artifact.Artifact artifact,
org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalysis dependencyAnalysis)
component - Componentartifact - Artifact from maven projectdependencyAnalysis - Dependency analysis dataCopyright © 2017–2022 OWASP Foundation. All rights reserved.