Skip to content

Commit

Permalink
work in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
andrzejj0 committed Dec 14, 2022
1 parent 916ab5f commit cbfe0be
Showing 1 changed file with 2 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1204,36 +1204,6 @@ public static void debugModules(Log logger, String message, Collection<String> 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<String> childModules) {
logger.debug("Removing child modules which are missing...");
Iterator<String> 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.
*
Expand Down Expand Up @@ -1384,19 +1354,13 @@ public static Map<File, Model> getChildModels(MavenProject project, Log logger)
private static Map<File, Model> getChildModels(Model model, MavenProject project, Log logger) throws IOException {
Map<File, Model> result = new LinkedHashMap<>();
Map<File, Model> childResults = new LinkedHashMap<>();
Set<String> 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
Expand Down

0 comments on commit cbfe0be

Please sign in to comment.