List<MavenArchetype> (@NotNull Path userArchetypesPath) { try { if (!Files.exists(userArchetypesPath)) { return Collections.emptyList(); } // Store artifact to set to remove duplicate created by old IDEA (https://youtrack.jetbrains.com/issue/IDEA-72105) Collection<MavenArchetype> result = new LinkedHashSet<>(); List<Element> children = JDOMUtil.load(userArchetypesPath).getChildren(ELEMENT_ARCHETYPE); for (int i = children.size() - 1; i >= 0; i--) { Element each = children.get(i); String groupId = each.getAttributeValue(ELEMENT_GROUP_ID); String artifactId = each.getAttributeValue(ELEMENT_ARTIFACT_ID); String version = each.getAttributeValue(ELEMENT_VERSION); String repository = each.getAttributeValue(ELEMENT_REPOSITORY); String description = each.getAttributeValue(ELEMENT_DESCRIPTION); if (StringUtil.isEmptyOrSpaces(groupId) || StringUtil.isEmptyOrSpaces(artifactId) || StringUtil.isEmptyOrSpaces(version)) { continue; } result.add(new MavenArchetype(groupId, artifactId, version, repository, description)); } ArrayList<MavenArchetype> listResult = new ArrayList<>(result); Collections.reverse(listResult); return listResult; } catch (IOException | JDOMException e) { MavenLog.LOG.warn(e); return Collections.emptyList(); } }