use of org.apache.maven.shared.dependency.tree.filter.DependencyNodeFilter in project maven-plugins by apache.
the class DependencyConvergenceReport 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(String includes) {
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));
}
return filters.isEmpty() ? null : new AndDependencyNodeFilter(filters);
}
use of org.apache.maven.shared.dependency.tree.filter.DependencyNodeFilter in project maven-plugins by apache.
the class DependencyConvergenceReport method serializeDependencyTree.
/**
* Serializes the specified dependency tree to a string.
*
* @param rootNode the dependency tree root node to serialize
* @return the serialized dependency tree
*/
private void serializeDependencyTree(DependencyNode rootNode, String key, Sink sink) {
DependencyNodeVisitor visitor = getSerializingDependencyNodeVisitor(sink);
visitor = new BuildingDependencyNodeVisitor(visitor);
DependencyNodeFilter filter = createDependencyNodeFilter(key);
if (filter != null) {
CollectingDependencyNodeVisitor collectingVisitor = new CollectingDependencyNodeVisitor();
DependencyNodeVisitor firstPassVisitor = new FilteringDependencyNodeVisitor(collectingVisitor, filter);
rootNode.accept(firstPassVisitor);
DependencyNodeFilter secondPassFilter = new AncestorOrSelfDependencyNodeFilter(collectingVisitor.getNodes());
visitor = new FilteringDependencyNodeVisitor(visitor, secondPassFilter);
}
rootNode.accept(visitor);
}
Aggregations