void (List<MavenArchetype> userArchetypes, @NotNull Path userArchetypesPath) { Element root = new Element(ELEMENT_ARCHETYPES); for (MavenArchetype each : userArchetypes) { Element childElement = new Element(ELEMENT_ARCHETYPE); childElement.setAttribute(ELEMENT_GROUP_ID, each.groupId); childElement.setAttribute(ELEMENT_ARTIFACT_ID, each.artifactId); childElement.setAttribute(ELEMENT_VERSION, each.version); if (each.repository != null) { childElement.setAttribute(ELEMENT_REPOSITORY, each.repository); } if (each.description != null) { childElement.setAttribute(ELEMENT_DESCRIPTION, each.description); } root.addContent(childElement); } try { JDOMUtil.write(root, userArchetypesPath); } catch (IOException e) { MavenLog.LOG.warn(e); } }