use of org.apache.maven.shared.dependency.graph.filter.ArtifactDependencyNodeFilter in project maven-plugins by apache.
the class TreeMojo method createDependencyNodeFilter.
/**
* Gets the dependency node filter to use when serializing the dependency graph.
*
* @return the dependency node filter, or <code>null</code> if none required
*/
private DependencyNodeFilter createDependencyNodeFilter() {
List<DependencyNodeFilter> filters = new ArrayList<DependencyNodeFilter>();
// filter includes
if (includes != null) {
List<String> patterns = Arrays.asList(includes.split(","));
getLog().debug("+ Filtering dependency tree by artifact include patterns: " + patterns);
ArtifactFilter artifactFilter = new StrictPatternIncludesArtifactFilter(patterns);
filters.add(new ArtifactDependencyNodeFilter(artifactFilter));
}
// filter excludes
if (excludes != null) {
List<String> patterns = Arrays.asList(excludes.split(","));
getLog().debug("+ Filtering dependency tree by artifact exclude patterns: " + patterns);
ArtifactFilter artifactFilter = new StrictPatternExcludesArtifactFilter(patterns);
filters.add(new ArtifactDependencyNodeFilter(artifactFilter));
}
return filters.isEmpty() ? null : new AndDependencyNodeFilter(filters);
}
Aggregations