private static void prettyPrint(DependencyNode node, Predicate<DependencyNode> filter, StringBuilder builder, int depth) { if (filter.accept(node)) { for (int i = 0; i < depth; i++) { builder.append(" "); } if (depth > 0) { builder.append("|-"); } builder.append(node.getDependency()) .append(" (") .append(node.getDependency().getScopeType()) .append(")\n"); for (DependencyNode child : node.getChildren()) { prettyPrint(child, filter, builder, depth + 1); } } }
public static DependencyBuilder create(final Dependency dep) { DependencyBuilder builder = new DependencyBuilder(); builder.setCoordinate(dep.getCoordinate()); builder.setScopeType(dep.getScopeType()); return builder; }
public MavenDependencyAdapter(final Dependency dep) { if (dep == null) { throw new IllegalArgumentException("Dependency must not be null."); } this.setArtifactId(dep.getCoordinate().getArtifactId()); this.setGroupId(dep.getCoordinate().getGroupId()); this.setVersion(dep.getCoordinate().getVersion()); this.setScope(dep.getScopeType()); this.setType(dep.getCoordinate().getPackaging()); this.setClassifier(dep.getCoordinate().getClassifier()); this.setSystemPath(dep.getCoordinate().getSystemPath()); if (dep.getExcludedCoordinates() != null) { for (Coordinate exclusion : dep.getExcludedCoordinates()) { Exclusion temp = new Exclusion(); temp.setArtifactId(exclusion.getArtifactId()); temp.setGroupId(exclusion.getGroupId()); this.getExclusions().add(temp); } } }