From cbfe0be517d5e9d93f3c0edc34258ca2ee9d0954 Mon Sep 17 00:00:00 2001 From: Andrzej Jarmoniuk Date: Wed, 14 Dec 2022 19:19:56 +0100 Subject: [PATCH] work in progress --- .../codehaus/mojo/versions/api/PomHelper.java | 40 +------------------ 1 file changed, 2 insertions(+), 38 deletions(-) diff --git a/versions-common/src/main/java/org/codehaus/mojo/versions/api/PomHelper.java b/versions-common/src/main/java/org/codehaus/mojo/versions/api/PomHelper.java index 24877f78e..7b1fddb4f 100644 --- a/versions-common/src/main/java/org/codehaus/mojo/versions/api/PomHelper.java +++ b/versions-common/src/main/java/org/codehaus/mojo/versions/api/PomHelper.java @@ -1204,36 +1204,6 @@ public static void debugModules(Log logger, String message, Collection m } } - /** - * Modifies the collection of child modules removing those which cannot be found relative to the parent. - * - * @param logger The logger to log to. - * @param basedir the project basedir. - * @param childModules the child modules. - */ - public static void removeMissingChildModules(Log logger, File basedir, Collection childModules) { - logger.debug("Removing child modules which are missing..."); - Iterator i = childModules.iterator(); - while (i.hasNext()) { - String modulePath = i.next(); - File moduleFile = new File(basedir, modulePath); - - if (moduleFile.isDirectory() && new File(moduleFile, "pom.xml").isFile()) { - // it's a directory that exists - continue; - } - - if (moduleFile.isFile()) { - // it's the pom.xml file directly referenced and it exists. - continue; - } - - logger.debug("Removing missing child module " + modulePath); - i.remove(); - } - debugModules(logger, "After removing missing", childModules); - } - /** * Extracts the version from a raw model, interpolating from the parent if necessary. * @@ -1384,19 +1354,13 @@ public static Map getChildModels(MavenProject project, Log logger) private static Map getChildModels(Model model, MavenProject project, Log logger) throws IOException { Map result = new LinkedHashMap<>(); Map childResults = new LinkedHashMap<>(); - Set childModules = getAllChildModules(model, logger); File baseDir = model.getPomFile().getParentFile(); - // removeMissingChildModules(logger, baseDir, childModules); - - childModules.stream() + getAllChildModules(model, logger).parallelStream() .map(moduleName -> new File(baseDir, moduleName)) .map(file -> file.isFile() ? file : new File(file, "pom.xml")) - // .filter(File::exists) + .filter(File::exists) .forEach(pomFile -> { - // File pomFile = moduleFile.isDirectory() ? new File(moduleFile, "/pom.xml") : - // moduleFile; - try { // the aim of this goal is to fix problems when the project cannot be parsed by Maven, // so we have to work with the raw model and not the interpolated parsed model from maven