Skip to content

Commit a2754bf

Browse files
authored
Merge pull request #304 from CycloneDX/streamline-output
streamline plugin output
2 parents ecadefd + c71f9ef commit a2754bf

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Default Values
5757
<outputFormat>all</outputFormat>
5858
<outputName>bom</outputName>
5959
<outputDirectory>${project.build.directory}</outputDirectory><!-- usually target, if not redefined in pom.xml -->
60-
<verbose>true</verbose><!-- = ${cyclonedx.verbose} -->
60+
<verbose>false</verbose><!-- = ${cyclonedx.verbose} -->
6161
</configuration>
6262
</plugin>
6363
</plugins>

src/it/makeAggregateBom/verify.groovy

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,8 @@ assert 2 == (buildLog =~ /\[INFO\] CycloneDX: Resolving Aggregated Dependencies/
2525
// 13 = 6 modules for main cyclonedx-makeAggregateBom execution
2626
// + 1 for root module cyclonedx-makeAggregateBom-root-only execution
2727
// + 6 modules for additional cyclonedx-makeBom execution
28-
assert 13 == (buildLog =~ /\[INFO\] CycloneDX: Writing BOM \(XML\)/).size()
29-
assert 13 == (buildLog =~ /\[INFO\] CycloneDX: Validating BOM \(XML\)/).size()
30-
assert 13 == (buildLog =~ /\[INFO\] CycloneDX: Writing BOM \(JSON\)/).size()
31-
assert 13 == (buildLog =~ /\[INFO\] CycloneDX: Validating BOM \(JSON\)/).size()
28+
assert 13 == (buildLog =~ /\[INFO\] CycloneDX: Writing and validating BOM \(XML\)/).size()
29+
assert 13 == (buildLog =~ /\[INFO\] CycloneDX: Writing and validating BOM \(JSON\)/).size()
3230
// cyclonedx-makeAggregateBom-root-only execution skips 5 non-root modules
3331
assert 5 == (buildLog =~ /\[INFO\] Skipping CycloneDX on non-execution root/).size()
3432

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,8 @@ public abstract class BaseCycloneDxMojo extends AbstractMojo {
187187
* @since 2.6.0
188188
*/
189189
@SuppressWarnings("CanBeFinal")
190-
@Parameter(property = "cyclonedx.verbose", defaultValue = "true", required = false)
191-
private boolean verbose = true;
190+
@Parameter(property = "cyclonedx.verbose", defaultValue = "false", required = false)
191+
private boolean verbose = false;
192192

193193
@org.apache.maven.plugins.annotations.Component
194194
private MavenProjectHelper mavenProjectHelper;
@@ -204,10 +204,10 @@ public abstract class BaseCycloneDxMojo extends AbstractMojo {
204204
*/
205205
protected static final String MESSAGE_RESOLVING_DEPS = "CycloneDX: Resolving Dependencies";
206206
protected static final String MESSAGE_RESOLVING_AGGREGATED_DEPS = "CycloneDX: Resolving Aggregated Dependencies";
207-
protected static final String MESSAGE_CREATING_BOM = "CycloneDX: Creating BOM";
207+
protected static final String MESSAGE_CREATING_BOM = "CycloneDX: Creating BOM version %s with %d component(s)";
208208
static final String MESSAGE_CALCULATING_HASHES = "CycloneDX: Calculating Hashes";
209-
protected static final String MESSAGE_WRITING_BOM = "CycloneDX: Writing BOM (%s): %s";
210-
protected static final String MESSAGE_VALIDATING_BOM = "CycloneDX: Validating BOM (%s): %s";
209+
protected static final String MESSAGE_WRITING_BOM = "CycloneDX: Writing and validating BOM (%s): %s";
210+
protected static final String MESSAGE_ATTACHING_BOM = " attaching as %s-%s-cyclonedx.%s";
211211
protected static final String MESSAGE_VALIDATION_FAILURE = "The BOM does not conform to the CycloneDX BOM standard as defined by the XSD";
212212

213213
/**
@@ -266,7 +266,7 @@ public void execute() throws MojoExecutionException {
266266

267267
private void generateBom(String analysis, Metadata metadata, Set<Component> components, Set<Dependency> dependencies) throws MojoExecutionException {
268268
try {
269-
getLog().info(MESSAGE_CREATING_BOM);
269+
getLog().info(String.format(MESSAGE_CREATING_BOM, schemaVersion, components.size()));
270270
final Bom bom = new Bom();
271271
bom.setComponents(new ArrayList<>(components));
272272

@@ -323,12 +323,12 @@ private void saveBomToFile(String bomString, String extension, Parser bomParser)
323323
getLog().info(String.format(MESSAGE_WRITING_BOM, extension.toUpperCase(), bomFile.getAbsolutePath()));
324324
FileUtils.write(bomFile, bomString, StandardCharsets.UTF_8, false);
325325

326-
getLog().info(String.format(MESSAGE_VALIDATING_BOM, extension.toUpperCase(), bomFile.getAbsolutePath()));
327326
if (!bomParser.isValid(bomFile, schemaVersion())) {
328327
throw new MojoExecutionException(MESSAGE_VALIDATION_FAILURE);
329328
}
330329

331330
if (!skipAttach) {
331+
getLog().info(String.format(MESSAGE_ATTACHING_BOM, project.getArtifactId(), project.getVersion(), extension));
332332
mavenProjectHelper.attachArtifact(project, extension, "cyclonedx", bomFile);
333333
}
334334
}

0 commit comments

Comments
 (0)