Search in sources :

Example 1 with DependencyVersionMap

use of org.apache.maven.report.projectinfo.dependencies.DependencyVersionMap in project maven-plugins by apache.

the class DependencyConvergenceReport method getConflictingDependencyMap.

/**
 * Get conflicting dependency map base on specified dependency node.
 *
 * @param conflictingDependencyMap
 * @param reactorProject
 * @param node
 */
private void getConflictingDependencyMap(Map<String, List<ReverseDependencyLink>> conflictingDependencyMap, MavenProject reactorProject, DependencyNode node) {
    DependencyVersionMap visitor = new DependencyVersionMap();
    visitor.setUniqueVersions(true);
    node.accept(visitor);
    for (List<DependencyNode> nodes : visitor.getConflictedVersionNumbers()) {
        DependencyNode dependencyNode = nodes.get(0);
        String key = dependencyNode.getArtifact().getGroupId() + ":" + dependencyNode.getArtifact().getArtifactId();
        List<ReverseDependencyLink> dependencyList = conflictingDependencyMap.get(key);
        if (dependencyList == null) {
            dependencyList = new ArrayList<ReverseDependencyLink>();
        }
        // CHECKSTYLE_OFF: LineLength
        dependencyList.add(new ReverseDependencyLink(toDependency(dependencyNode.getArtifact()), reactorProject));
        for (DependencyNode workNode : nodes.subList(1, nodes.size())) {
            // CHECKSTYLE_OFF: LineLength
            dependencyList.add(new ReverseDependencyLink(toDependency(workNode.getArtifact()), reactorProject));
        // CHECKSTYLE_ON: LineLength
        }
        conflictingDependencyMap.put(key, dependencyList);
    }
}
Also used : DependencyNode(org.apache.maven.shared.dependency.tree.DependencyNode) DependencyVersionMap(org.apache.maven.report.projectinfo.dependencies.DependencyVersionMap)

Aggregations

DependencyVersionMap (org.apache.maven.report.projectinfo.dependencies.DependencyVersionMap)1 DependencyNode (org.apache.maven.shared.dependency.tree.DependencyNode)1