private static Set < Artifact > getTransitiveDependencies ( AbstractWisdomMojo mojo , DependencyGraphBuilder graph , ArtifactFilter filter ) { Set < Artifact > artifacts ; artifacts = new LinkedHashSet <> ( ) ; try { Set < Artifact > transitives = new LinkedHashSet <> ( ) ; DependencyNode node = graph . buildDependencyGraph ( mojo . project , filter ) ; node . accept ( new ArtifactVisitor ( mojo , transitives ) ) ; mojo . getLog ( ) . debug ( transitives . size ( ) + " transitive dependencies have been collected : " + transitives ) ; // Unfortunately, the retrieved artifacts are not resolved, we need to find their 'surrogates' in the // resolved list. Set < Artifact > resolved = mojo . project . getArtifacts ( ) ; for ( Artifact a : transitives ) { Artifact r = getArtifact ( a , resolved ) ; if ( r == null ) { mojo . getLog ( ) . warn ( "Cannot find resolved artifact for " + a ) ; } else { artifacts . add ( r ) ; } } } catch ( DependencyGraphBuilderException e ) { mojo . getLog ( ) . error ( "Cannot traverse the project's dependencies to collect transitive dependencies, " + "ignoring transitive" ) ; mojo . getLog ( ) . debug ( "Here is the thrown exception having disabled the transitive dependency collection" , e ) ; artifacts = mojo . project . getDependencyArtifacts ( ) ; } return artifacts ; }
Collects the transitive dependencies of the current projects .