added excludeInternalGroupIds configuration parameter that allows the exclusion of groupIds of internal projects. This is to speed up analysis as internal projects have no public vulnerabilites nor a sonatype listing but do frequently have names that collide with other libraries. The parameter can have multiple values, e.g. <excludeInternalGroupIds><groupId>nl.someinteral.project</groupId><groupId>org.another.one</groupId></excludeInternalGroupIds>

Former-commit-id: ffa0716366c6c7b65d1181f2bd945472b75b5483
This commit is contained in:
Erik Hooijmeijer
2014-10-22 19:08:33 +02:00
parent 35c2f4873c
commit 5caf023677

View File

@@ -33,6 +33,7 @@ import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.commons.lang.StringUtils;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
@@ -242,6 +243,13 @@ public class DependencyCheckMojo extends ReportAggregationMojo {
@SuppressWarnings("CanBeFinal")
@Parameter(property = "skipProvidedScope", defaultValue = "false", required = false)
private boolean skipProvidedScope = false;
/**
* Skip Analysis of Dependencies that have a groupId that starts with this string.
* Multiple excludes are allowed by repeating the element.
*/
@SuppressWarnings("CanBeFinal")
@Parameter(property = "excludeInternalGroupIds", required = false)
private String[] excludeInternalGroupIds = new String[0];
/**
* The data directory, hold DC SQL DB.
*/
@@ -362,6 +370,12 @@ public class DependencyCheckMojo extends ReportAggregationMojo {
if (skipRuntimeScope && !Artifact.SCOPE_RUNTIME.equals(a.getScope())) {
return true;
}
for (String groupId : excludeInternalGroupIds) {
if (!StringUtils.isEmpty(groupId) && (a.getGroupId().startsWith(groupId))) {
LOGGER.log(Level.INFO, "Excluding " + a.getGroupId() + ":" + a.getArtifactId());
return true;
}
}
return false;
}