Skip to content

Commit

Permalink
make classifier used to attach the sbom configurable
Browse files Browse the repository at this point in the history
Signed-off-by: Olivier Lamy <olamy@apache.org>
  • Loading branch information
olamy authored and hboutemy committed May 30, 2024
1 parent 36398ca commit 2d40108
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ The CycloneDX Maven plugin contains the following three goals:
* `makeAggregateBom`: creates an aggregate BOM at build root (with dependencies from the whole multi-modules build), and eventually a BOM for each module,
* `makePackageBom`: creates a BOM for each Maven module with `war` or `ear` packaging.

By default, the BOM(s) will be attached as an additional artifacts with `cyclonedx` classifier and `xml` or `json` extension during a Maven `install` or `deploy`:
By default, the BOM(s) will be attached as an additional artifacts with `cyclonedx` classifier (can be customized by setting `cyclonedx.classifier`) and `xml` or `json` extension during a Maven `install` or `deploy`:

* `${project.artifactId}-${project.version}-cyclonedx.xml`
* `${project.artifactId}-${project.version}-cyclonedx.json`
Expand Down
10 changes: 9 additions & 1 deletion src/main/java/org/cyclonedx/maven/BaseCycloneDxMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,14 @@ public abstract class BaseCycloneDxMojo extends AbstractMojo {
@Parameter(property = "cyclonedx.skipAttach", defaultValue = "false", required = false)
private boolean skipAttach = false;

/**
* Classifier of the attached sbom
*
* @since 2.8.1
*/
@Parameter(property = "cyclonedx.classifier", defaultValue = "cyclonedx")
private String classifier;

/**
* Verbose output.
*
Expand Down Expand Up @@ -456,7 +464,7 @@ private void saveBomToFile(String bomString, String extension, Parser bomParser)

if (!skipAttach) {
getLog().info(String.format(MESSAGE_ATTACHING_BOM, project.getArtifactId(), project.getVersion(), extension));
mavenProjectHelper.attachArtifact(project, extension, "cyclonedx", bomFile);
mavenProjectHelper.attachArtifact(project, extension, classifier, bomFile);
}
}

Expand Down

0 comments on commit 2d40108

Please sign in to comment.