/** * Visits all nodes from the given node and collects dependencies. * * @param node DependencyNode from which to search. * @param collecting Whether we are currently collecting artifacts. */ public void visit( DependencyNode node, boolean collecting ) { if ( collecting ) { dependencies.add( node.getArtifact() ); } if ( matchesTarget( node.getArtifact() ) ) { collecting = true; log.debug( "Found target. Collecting dependencies after " + node.getArtifact() ); } for ( final DependencyNode child : node.getChildren() ) { visit( child, collecting ); } }
/** * @param project MavenProject for which to return the dependencies. * @param session MavenSession in which to look for reactor dependencies. * @return all the dependencies for a project. * @throws DependencyGraphBuilderException if the dependency graph can't be built. */ public Set<Artifact> getProjectDependenciesFor( MavenProject project, MavenSession session ) throws DependencyGraphBuilderException { // No need to filter our search. We want to resolve all artifacts. final DependencyNode node = dependencyGraphBuilder.buildDependencyGraph( project, null, session.getProjects() ); final DependencyCollector collector = new DependencyCollector( log, project.getArtifact() ); collector.visit( node, false ); return collector.getDependencies(); }
final DependencyNode dn = dependencyGraphBuilder.buildDependencyGraph(buildingRequest, null, reactorProjects); final CollectingDependencyNodeVisitor visitor = new CollectingDependencyNodeVisitor(); dn.accept(visitor); for (DependencyNode node : visitor.getNodes()) { if (filter.include(node.getArtifact())) { nodes.add(node);
@Override public Artifact apply(DependencyNode input) { return input.getArtifact(); } }));
ExceptionCollection exCol = collectDependencyManagementDependencies(buildingRequest, project, nodes, aggregate); for (DependencyNode dependencyNode : nodes) { if (artifactScopeExcluded.passes(dependencyNode.getArtifact().getScope()) || artifactTypeExcluded.passes(dependencyNode.getArtifact().getType())) { continue; String version = null; List<ArtifactVersion> availableVersions = null; if (org.apache.maven.artifact.Artifact.SCOPE_SYSTEM.equals(dependencyNode.getArtifact().getScope())) { for (org.apache.maven.model.Dependency d : project.getDependencies()) { final Artifact a = dependencyNode.getArtifact(); if (d.getSystemPath() != null && artifactsMatch(d, a)) { getLog().error("Unable to resolve system scoped dependency: " + dependencyNode.toNodeString()); if (exCol == null) { exCol = new ExceptionCollection(); + dependencyNode.toNodeString())); final ArtifactCoordinate coordinate = TransferUtils.toArtifactCoordinate(dependencyNode.getArtifact()); final Artifact result; try { getLog().debug(String.format("Aggregate : %s", aggregate)); boolean addException = true; if (!aggregate || addReactorDependency(engine, dependencyNode.getArtifact())) { addException = false; && dependencyNode.getArtifact().isSnapshot() && aggregate
protected DependencyNode buildDependencyGraph( MavenProject mavenProject ) throws MojoExecutionException { DependencyNode dependencyGraph; try { dependencyGraph = m_dependencyGraphBuilder.buildDependencyGraph( mavenProject, null ); } catch ( DependencyGraphBuilderException e ) { throw new MojoExecutionException( e.getMessage(), e ); } return dependencyGraph; }
/** * {@inheritDoc} */ public boolean endVisit( DependencyNode node ) { parentNodes.pop(); // apply the visitor to the resultant tree on the last visit if ( parentNodes.empty() && visitor != null ) { rootNode.accept( visitor ); } return true; }
/** * Traverses a tree rooted at the given node. */ protected void visit(DependencyNode g) { if (accept(g)) { for (DependencyNode dn : g.getChildren()) { visit(dn); } } }
/** * {@inheritDoc} */ public boolean visit( DependencyNode node ) { indent( node ); writer.println( node.toNodeString() ); depth++; return true; }
/** * {@inheritDoc} */ @Override public boolean visit( DependencyNode node ) { // write node writer.write( generateId( node ) ); writer.write( " " ); writer.println( node.toNodeString() ); return true; }
filter.add( optionalFilter ); final DependencyNode node = dependencyGraphBuilder.buildDependencyGraph( project, filter ); final CollectingDependencyNodeVisitor collectingVisitor = new CollectingDependencyNodeVisitor(); node.accept( collectingVisitor ); final List<DependencyNode> dependencies = collectingVisitor.getNodes(); for ( final DependencyNode dep : dependencies ) final boolean isNativeLibrary = isNativeLibrary( sharedLibraries, dep.getArtifact().getType() ); if ( isNativeLibrary ) artifacts.add( dep.getArtifact() );
@Override public boolean endVisit(DependencyNode node) { Artifact artifact = node.getArtifact(); Optional<Dependency> dependencyOption = artifactInConfiguredList(artifact, configuredScannedDependencies); if (dependencyOption.isPresent()) { artifacts.addAll(findIncludedTransitiveDeps(node, dependencyOption.get())); } return true; } });
private DependencyNode getDependencyGraph(MavenProject project) { try { return dependencyGraphBuilder.buildDependencyGraph(project, new ArtifactFilter() { @Override public boolean include(Artifact artifact) { return isSensibleScope(artifact); } }); } catch (DependencyGraphBuilderException e) { throw new RuntimeException(e); } }
/** * {@inheritDoc} */ @Override public boolean endVisit( DependencyNode node ) { parentNodes.pop(); // apply the visitor to the resultant tree on the last visit if ( parentNodes.empty() && visitor != null ) { rootNode.accept( visitor ); } return true; }
/** * {@inheritDoc} */ @Override public boolean visit( DependencyNode node ) { indent( node ); writer.println( node.toNodeString() ); depth++; return true; }
/** * {@inheritDoc} */ @Override public boolean accept( DependencyNode node ) { Artifact artifact = node.getArtifact(); return filter.include( artifact ); }
/** * Traverses the whole dependency tree rooted at the project. */ protected void traverseProject() throws DependencyGraphBuilderException { visit(graphBuilder.buildDependencyGraph(project, null)); }
/** * {@inheritDoc} */ public boolean accept( DependencyNode node ) { Artifact artifact = node.getArtifact(); return filter.include( artifact ); }
@Override public boolean accept(DependencyNode node) { return !isExcluded(node.getArtifact(), dependency.getExclusions()); } };