List<MavenProject> modules = new MavenProjectCollector(project).collect();
for (MavenProject module : modules) {
for (String sourceRoot : module.getCompileSourceRoots()) {
File sourceDirectory = new File(sourceRoot);
if (sourceDirectory.exists() && sourceDirectory.isDirectory()) {
DirectorySourceLoader moduleSourceLoader = new DirectorySourceLoader(baseDir, sourceDirectory, sourceEncoding);
multiSourceLoader.add(moduleSourceLoader);
}
}
}
if (sourceDirectories != null) {
for (File sourceDirectory : sourceDirectories) {
if (sourceDirectory.exists() && sourceDirectory.isDirectory()) {
DirectorySourceLoader moduleSourceLoader = new DirectorySourceLoader(baseDir, sourceDirectory, sourceEncoding);
multiSourceLoader.add(moduleSourceLoader);
}
}
}
return multiSourceLoader;