MavenDomDependency (@NotNull MavenDomProjectModel mavenModel, @NotNull Editor editor, @NotNull Map<DependencyConflictId, MavenDomDependency> managedDependencies, @NotNull List<? extends MavenCoordinate> ids) { boolean isInsideManagedDependencies; MavenDomDependencyManagement dependencyManagement = mavenModel.getDependencyManagement(); XmlElement managedDependencyXml = dependencyManagement.getXmlElement(); if (managedDependencyXml != null && managedDependencyXml.getTextRange().contains(editor.getCaretModel().getOffset())) { isInsideManagedDependencies = true; } else { isInsideManagedDependencies = false; } for (MavenCoordinate each : ids) { MavenDomDependency res; if (isInsideManagedDependencies) { res = MavenDomUtil.createDomDependency(dependencyManagement.getDependencies(), editor, each); } else { DependencyConflictId conflictId = new DependencyConflictId(each.getGroupId(), each.getArtifactId(), null, null); MavenDomDependency managedDependenciesDom = managedDependencies.get(conflictId); if (managedDependenciesDom != null && Objects.equals(each.getVersion(), managedDependenciesDom.getVersion().getStringValue())) { // Generate dependency without <version> tag res = MavenDomUtil.createDomDependency(mavenModel.getDependencies(), editor); res.getGroupId().setStringValue(conflictId.getGroupId()); res.getArtifactId().setStringValue(conflictId.getArtifactId()); } else { res = MavenDomUtil.createDomDependency(mavenModel.getDependencies(), editor, each); } } return (res); } return null; }