void (@NotNull Module module, @NotNull ModifiableRootModel model, @Nullable Library library) { VirtualFile[] roots = model.getContentRoots(); VirtualFile root; if (roots.length == 0) { VirtualFile moduleFile = module.getModuleFile(); if (moduleFile != null) { root = moduleFile.getParent(); model.addContentEntry(root); } else { return; } } else { root = roots[0]; } VirtualFile existingPom = null; for (VirtualFile child : root.getChildren()) { if (child.getName().startsWith("pom.")) { existingPom = child; } } if (existingPom != null) { MavenProjectsManager.getInstance(module.getProject()).addManagedFilesOrUnignore(Collections.singletonList(existingPom)); } else { prepareProjectStructure(model, root); new MavenModuleBuilderHelper(new MavenId("groupId", module.getName(), "1.0-SNAPSHOT"), null, null, false, false, null, null, MavenProjectBundle.message("command.name.add.maven.support")).configure(model.getProject(), root, true); } }