private static Set<DependencyDescriptor> getDependenciesTransitively(String scope, ResolvedDependency parent) {
        Stack<ResolvedDependency> stack = new Stack<>();
        stack.push(parent);
        Set<DependencyDescriptor> dependencies = new HashSet<>();
        while (!stack.empty()) {
            ResolvedDependency rd = stack.pop();
            // Skip the parent's artifacts.
            if (rd != parent) {
                rd.getModuleArtifacts().forEach(a -> dependencies.add(asDescriptor(scope, a)));
            }
            rd.getChildren().forEach(d -> {
                if (!stack.contains(d)) {
                    stack.add(d);
                }
            });
        }
        return dependencies;
    }
private static Set < DependencyDescriptor > getDependenciesTransitively ( String scope , ResolvedDependency parent ) { Stack < ResolvedDependency > stack = new Stack < > ( ) ; stack . push ( parent ) ; Set < DependencyDescriptor > dependencies = new HashSet < > ( ) ; while ( ! stack . empty ( ) ) { ResolvedDependency rd = stack . pop ( ) ; if ( rd != parent ) { rd . getModuleArtifacts ( ) . forEach ( a -> dependencies . add ( asDescriptor ( scope , a ) ) ) ; } rd . getChildren ( ) . forEach ( d -> { if ( ! stack . contains ( d ) ) { stack . add ( d ) ; } } ) ; } return dependencies ; }
Get the dependencies (transitively) of the given parent element.

@param scope  the scope to use for the parent.
@param parent the parent dependency.
@return a collection of all dependencies of the given parent.