if (otherManagedDependency.getManagementKey().equals(dependency.getManagementKey())) {
i.remove();
if (otherManagedDependency != dependency) {
final String version = modelUtil.getVersion(dependency);
final String otherVersion = modelUtil.getVersion(otherManagedDependency);
final InputLocation location = modelUtil.getLocation(dependency);
final InputLocation otherLocation = modelUtil.getLocation(otherManagedDependency);
if (ObjectUtils.equals(version, otherVersion)) {
resultCollector.addViolation(mavenProject, this, dependencyDescription + " '" + modelUtil.getKey(dependency) +
"' is declared multiple times with the same version: " +
otherLocation.getLineNumber() + ":" + otherLocation.getColumnNumber(), location);
} else {
resultCollector.addViolation(mavenProject, this, dependencyDescription + " '" + modelUtil.getKey(dependency) +
"' is declared multiple times with different versions (" + version + ", "
+ otherVersion + ")", location);
}