Search in sources :

Example 1 with DependencyConflictId

use of org.jetbrains.idea.maven.dom.DependencyConflictId in project intellij-community by JetBrains.

the class MavenDuplicateDependenciesInspection method checkManagedDependencies.

private static void checkManagedDependencies(@NotNull MavenDomProjectModel projectModel, @NotNull DomElementAnnotationHolder holder) {
    MultiMap<DependencyConflictId, MavenDomDependency> duplicates = MultiMap.createSet();
    collect(duplicates, projectModel.getDependencyManagement().getDependencies());
    for (Map.Entry<DependencyConflictId, Collection<MavenDomDependency>> entry : duplicates.entrySet()) {
        Collection<MavenDomDependency> set = entry.getValue();
        if (set.size() <= 1)
            continue;
        for (MavenDomDependency dependency : set) {
            holder.createProblem(dependency, HighlightSeverity.WARNING, "Duplicated dependency");
        }
    }
}
Also used : DependencyConflictId(org.jetbrains.idea.maven.dom.DependencyConflictId) MultiMap(com.intellij.util.containers.MultiMap) MavenDomDependency(org.jetbrains.idea.maven.dom.model.MavenDomDependency)

Example 2 with DependencyConflictId

use of org.jetbrains.idea.maven.dom.DependencyConflictId in project intellij-community by JetBrains.

the class MavenDuplicateDependenciesInspection method collect.

private static void collect(MultiMap<DependencyConflictId, MavenDomDependency> duplicates, @NotNull MavenDomDependencies dependencies) {
    for (MavenDomDependency dependency : dependencies.getDependencies()) {
        DependencyConflictId mavenId = DependencyConflictId.create(dependency);
        if (mavenId == null)
            continue;
        duplicates.putValue(mavenId, dependency);
    }
}
Also used : DependencyConflictId(org.jetbrains.idea.maven.dom.DependencyConflictId) MavenDomDependency(org.jetbrains.idea.maven.dom.model.MavenDomDependency)

Aggregations

DependencyConflictId (org.jetbrains.idea.maven.dom.DependencyConflictId)2 MavenDomDependency (org.jetbrains.idea.maven.dom.model.MavenDomDependency)2 MultiMap (com.intellij.util.containers.MultiMap)1