Search in sources :

Example 1 with ConflictIdSorter

use of org.eclipse.aether.util.graph.transformer.ConflictIdSorter in project fabric8 by jboss-fuse.

the class ReplaceConflictingVersionResolver method transformGraph.

public DependencyNode transformGraph(DependencyNode node, DependencyGraphTransformationContext context) throws RepositoryException {
    List<?> sortedConflictIds = (List<?>) context.get(TransformationContextKeys.SORTED_CONFLICT_IDS);
    if (sortedConflictIds == null) {
        ConflictIdSorter sorter = new ConflictIdSorter();
        sorter.transformGraph(node, context);
        sortedConflictIds = (List<?>) context.get(TransformationContextKeys.SORTED_CONFLICT_IDS);
    }
    Map<?, ?> conflictIds = (Map<?, ?>) context.get(TransformationContextKeys.CONFLICT_IDS);
    if (conflictIds == null) {
        throw new RepositoryException("conflict groups have not been identified");
    }
    Map<DependencyNode, Integer> depths = new TreeMap<DependencyNode, Integer>(DependencyNodeComparator.INSTANCE);
    for (Object key : sortedConflictIds) {
        ConflictGroup group = new ConflictGroup(key);
        depths.clear();
        selectVersion(node, null, 0, depths, group, conflictIds);
        updateNonSelectedVersions(group, conflictIds);
    }
    return node;
}
Also used : DependencyNode(org.eclipse.aether.graph.DependencyNode) ArrayList(java.util.ArrayList) List(java.util.List) ConflictIdSorter(org.eclipse.aether.util.graph.transformer.ConflictIdSorter) RepositoryException(org.eclipse.aether.RepositoryException) TreeMap(java.util.TreeMap) TreeMap(java.util.TreeMap) Map(java.util.Map)

Aggregations

ArrayList (java.util.ArrayList)1 List (java.util.List)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 RepositoryException (org.eclipse.aether.RepositoryException)1 DependencyNode (org.eclipse.aether.graph.DependencyNode)1 ConflictIdSorter (org.eclipse.aether.util.graph.transformer.ConflictIdSorter)1