catch ( ProjectBuildingException e )
{
throw new ConsumerException( e.getMessage(), e );
}
DependencyNode rootNode;
try
{
// TODO: do this for different values of new ScopeArtifactFilter( scope )
ArtifactFilter artifactFilter = null;
rootNode =
dependencyTreeBuilder.buildDependencyTree( project, localArtifactRepository, artifactFactory,
artifactMetadataSource, artifactFilter, artifactCollector );
}
catch ( DependencyTreeBuilderException e )
{
throw new ConsumerException( e.getMessage(), e );
}
Document document = DocumentHelper.createDocument();
DependencyNodeVisitor visitor = new XmlSerializingDependencyNodeVisitor( document );
// TODO: remove the need for this when the serializer can calculate last nodes from visitor calls only
visitor = new BuildingDependencyNodeVisitor( visitor );
CollectingDependencyNodeVisitor collectingVisitor = new CollectingDependencyNodeVisitor();
DependencyNodeVisitor firstPassVisitor =
new FilteringDependencyNodeVisitor( collectingVisitor, StateDependencyNodeFilter.INCLUDED );
rootNode.accept( firstPassVisitor );
DependencyNodeFilter secondPassFilter = new AncestorOrSelfDependencyNodeFilter( collectingVisitor.getNodes() );
visitor = new FilteringDependencyNodeVisitor( visitor, secondPassFilter );
rootNode.accept( visitor );
FileWriter writer = null;
try
{
Artifact artifact =