mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-20 08:14:44 +01:00
Branch showSummary on checkForFailure
This commit is contained in:
@@ -1079,9 +1079,16 @@ public class Check extends Update {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ids.length() > 0) {
|
if (ids.length() > 0) {
|
||||||
final String msg = String.format("%n%nDependency-Check Failure:%n"
|
final String msg;
|
||||||
|
if (showSummary) {
|
||||||
|
msg = String.format("%n%nDependency-Check Failure:%n"
|
||||||
+ "One or more dependencies were identified with vulnerabilities that have a CVSS score greater than '%.1f': %s%n"
|
+ "One or more dependencies were identified with vulnerabilities that have a CVSS score greater than '%.1f': %s%n"
|
||||||
+ "See the dependency-check report for more details.%n%n", failBuildOnCVSS, ids.toString());
|
+ "See the dependency-check report for more details.%n%n", failBuildOnCVSS, ids.toString());
|
||||||
|
} else {
|
||||||
|
msg = String.format("%n%nDependency-Check Failure:%n"
|
||||||
|
+ "One or more dependencies were identified with vulnerabilities.%n%n"
|
||||||
|
+ "See the dependency-check report for more details.%n%n");
|
||||||
|
}
|
||||||
throw new BuildException(msg);
|
throw new BuildException(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1021,9 +1021,16 @@ public class DependencyCheckScanAgent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ids.length() > 0) {
|
if (ids.length() > 0) {
|
||||||
final String msg = String.format("%n%nDependency-Check Failure:%n"
|
final String msg;
|
||||||
|
if (showSummary) {
|
||||||
|
msg = String.format("%n%nDependency-Check Failure:%n"
|
||||||
+ "One or more dependencies were identified with vulnerabilities that have a CVSS score greater than '%.1f': %s%n"
|
+ "One or more dependencies were identified with vulnerabilities that have a CVSS score greater than '%.1f': %s%n"
|
||||||
+ "See the dependency-check report for more details.%n%n", failBuildOnCVSS, ids.toString());
|
+ "See the dependency-check report for more details.%n%n", failBuildOnCVSS, ids.toString());
|
||||||
|
} else {
|
||||||
|
msg = String.format("%n%nDependency-Check Failure:%n"
|
||||||
|
+ "One or more dependencies were identified with vulnerabilities.%n%n"
|
||||||
|
+ "See the dependency-check report for more details.%n%n");
|
||||||
|
}
|
||||||
|
|
||||||
throw new ScanAgentException(msg);
|
throw new ScanAgentException(msg);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1193,6 +1193,7 @@ public abstract class BaseDependencyCheckMojo extends AbstractMojo implements Ma
|
|||||||
}
|
}
|
||||||
if (ids.length() > 0) {
|
if (ids.length() > 0) {
|
||||||
final String msg;
|
final String msg;
|
||||||
|
if (showSummary) {
|
||||||
if (failBuildOnAnyVulnerability) {
|
if (failBuildOnAnyVulnerability) {
|
||||||
msg = String.format("%n%nOne or more dependencies were identified with vulnerabilities: %n%s%n%n"
|
msg = String.format("%n%nOne or more dependencies were identified with vulnerabilities: %n%s%n%n"
|
||||||
+ "See the dependency-check report for more details.%n%n", ids.toString());
|
+ "See the dependency-check report for more details.%n%n", ids.toString());
|
||||||
@@ -1200,6 +1201,10 @@ public abstract class BaseDependencyCheckMojo extends AbstractMojo implements Ma
|
|||||||
msg = String.format("%n%nOne or more dependencies were identified with vulnerabilities that have a CVSS score greater than '%.1f': "
|
msg = String.format("%n%nOne or more dependencies were identified with vulnerabilities that have a CVSS score greater than '%.1f': "
|
||||||
+ "%n%s%n%nSee the dependency-check report for more details.%n%n", failBuildOnCVSS, ids.toString());
|
+ "%n%s%n%nSee the dependency-check report for more details.%n%n", failBuildOnCVSS, ids.toString());
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
msg = String.format("%n%nOne or more dependencies were identified with vulnerabilities.%n%n"
|
||||||
|
+ "See the dependency-check report for more details.%n%n");
|
||||||
|
}
|
||||||
|
|
||||||
throw new MojoFailureException(msg);
|
throw new MojoFailureException(msg);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user