mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-17 23:04:07 +01:00
update to make failure more verbose for issue #57
Former-commit-id: 7315afe74cc78c65254e5f12032ece0a461be751
This commit is contained in:
@@ -748,12 +748,12 @@ public class DependencyCheckMojo extends AbstractMojo implements MavenMultiPageR
|
|||||||
public void execute() throws MojoExecutionException, MojoFailureException {
|
public void execute() throws MojoExecutionException, MojoFailureException {
|
||||||
final Engine engine = executeDependencyCheck();
|
final Engine engine = executeDependencyCheck();
|
||||||
generateExternalReports(engine);
|
generateExternalReports(engine);
|
||||||
if (this.failBuildOnCVSS <= 10) {
|
|
||||||
checkForFailure(engine.getDependencies());
|
|
||||||
}
|
|
||||||
if (this.showSummary) {
|
if (this.showSummary) {
|
||||||
showSummary(engine.getDependencies());
|
showSummary(engine.getDependencies());
|
||||||
}
|
}
|
||||||
|
if (this.failBuildOnCVSS <= 10) {
|
||||||
|
checkForFailure(engine.getDependencies());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -867,9 +867,12 @@ public class DependencyCheckMojo extends AbstractMojo implements MavenMultiPageR
|
|||||||
private void checkForFailure(List<Dependency> dependencies) throws MojoFailureException {
|
private void checkForFailure(List<Dependency> dependencies) throws MojoFailureException {
|
||||||
final StringBuilder ids = new StringBuilder();
|
final StringBuilder ids = new StringBuilder();
|
||||||
for (Dependency d : dependencies) {
|
for (Dependency d : dependencies) {
|
||||||
|
boolean addName = true;
|
||||||
for (Vulnerability v : d.getVulnerabilities()) {
|
for (Vulnerability v : d.getVulnerabilities()) {
|
||||||
if (v.getCvssScore() >= failBuildOnCVSS) {
|
if (v.getCvssScore() >= failBuildOnCVSS) {
|
||||||
if (ids.length() == 0) {
|
if (addName) {
|
||||||
|
addName = false;
|
||||||
|
ids.append(NEW_LINE).append(d.getFileName()).append(": ");
|
||||||
ids.append(v.getName());
|
ids.append(v.getName());
|
||||||
} else {
|
} else {
|
||||||
ids.append(", ").append(v.getName());
|
ids.append(", ").append(v.getName());
|
||||||
|
|||||||
Reference in New Issue
Block a user