in src/main/java/org/apache/maven/plugins/pmd/AbstractPmdReport.java [554:580]
private Set<MavenProject> modulesForAggregatedProject(
MavenProject aggregatedProject, Map<Path, MavenProject> reactorProjectsMap) {
// Maven does not supply an easy way to get the projects representing
// the modules of a project. So we will get the paths to the base
// directories of the modules from the project and compare with the
// base directories of the projects in the reactor.
if (aggregatedProject.getModules().isEmpty()) {
return Collections.singleton(aggregatedProject);
}
List<Path> modulePaths = new LinkedList<Path>();
for (String module : aggregatedProject.getModules()) {
modulePaths.add(new File(aggregatedProject.getBasedir(), module).toPath());
}
Set<MavenProject> aggregatedModules = new LinkedHashSet<>();
for (Path modulePath : modulePaths) {
MavenProject module = reactorProjectsMap.remove(modulePath);
if (module != null) {
aggregatedModules.addAll(modulesForAggregatedProject(module, reactorProjectsMap));
}
}
return aggregatedModules;
}