Skip to content

Commit 8e11ad8

Browse files
committed
Provide filter by group IDs
Provides a new parameter excludeGroupId to exclude all artifacts of specific group IDs, similar to excludeArtifactId.
1 parent acd56d3 commit 8e11ad8

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ With `makeAggregateBom` goal it is possible to exclude certain Maven Projects (a
6969

7070
* Pass `-DexcludeTestProject=true` to skip any maven project artifactId containing the word "test"
7171
* Pass `-DexcludeArtifactId=comma separated id` to skip based on artifactId
72+
* Pass `-DexcludeGroupId=comma separated id` to skip based on groupId
7273

7374
Goals
7475
-------------------

src/main/java/org/cyclonedx/maven/BaseCycloneDxMojo.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,9 @@ public abstract class BaseCycloneDxMojo extends AbstractMojo implements Contextu
149149
@Parameter(property = "excludeArtifactId", required = false)
150150
protected String[] excludeArtifactId;
151151

152+
@Parameter(property = "excludeGroupId", required = false)
153+
protected String[] excludeGroupId;
154+
152155
@Parameter(property = "excludeTestProject", defaultValue = "false", required = false)
153156
protected Boolean excludeTestProject;
154157

@@ -338,6 +341,15 @@ public String[] getExcludeArtifactId() {
338341
return excludeArtifactId;
339342
}
340343

344+
/**
345+
* Returns if excluded GroupId are defined.
346+
*
347+
* @return an array of excluded Group Id
348+
*/
349+
public String[] getExcludeGroupId() {
350+
return excludeGroupId;
351+
}
352+
341353
/**
342354
* Returns if project artifactId with the word test should be excluded in bom.
343355
*

src/main/java/org/cyclonedx/maven/CycloneDxAggregateMojo.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ protected boolean shouldExclude(MavenProject mavenProject) {
5050
if (excludeArtifactId != null && excludeArtifactId.length > 0) {
5151
shouldExclude = Arrays.asList(excludeArtifactId).contains(mavenProject.getArtifactId());
5252
}
53+
if (!shouldExclude && excludeGroupId != null && excludeGroupId.length > 0) {
54+
shouldExclude = Arrays.asList(excludeGroupId).contains(mavenProject.getGroupId());
55+
}
5356
if (excludeTestProject && mavenProject.getArtifactId().contains("test")) {
5457
shouldExclude = true;
5558
}

0 commit comments

Comments
 (0)