/** * Get groupId of artifact. If artifact doesn't have groupId this method checks parent artifact * for groupId. */ public static String getGroupId(Model model) { String groupId = model.getGroupId(); if (groupId == null) { final Parent parent = model.getParent(); if (parent != null) { groupId = parent.getGroupId(); } } return groupId; }
private static void addModules(Model model, List<Model> modules) throws IOException { if (!"pom".equals(model.getPackaging())) return; for (String module : model.getModules()) { final Path modulePom = model.getProjectDirectory().toPath().resolve(module).resolve("pom.xml"); if (exists(modulePom)) { final Model child = Model.readFrom(modulePom); final String relativePath = modulePom.getParent().relativize(model.getPomFile().toPath()).toString(); child.setParent( new Parent(model.getGroupId(), model.getArtifactId(), model.getVersion()) .setRelativePath(relativePath)); modules.add(child); addModules(child, modules); } } }