Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make classifier used to attach the sbom configurable #506

Merged
merged 1 commit into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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